#include <stdio.h>
#define H 50
#define F 40
#define T 33
#define Q 25
int main(void)
{
float price, x;
float newprice;
char code;
printf("Please insert the price of the the article: ");
scanf("%f", &price);
printf("Please insert the pricing code: ");
scanf("%c", &code);
switch (code)
{
case 'h':
{
newprice=price*(H/100);
x=H;
}
case 'f':
{
newprice=price*(F/100);
x=F;
}
case 't':
{
newprice=price*(T/100);
x=T;
}
case 'q':
{
newprice=price*(Q/100);
x=Q;
}
}
printf("\nThe original price was: %d", price);
printf("\nThe new price is: %f", newprice);
printf("\nThe amount of discount is: %d%%", x);
getch();
return 0;
}حيث انى بعد الكوبيل و ادخال الرقمين يعطى اصفار فالنتائج
