السلام عليكم ,,,
يالليت احد يساعدني في ذا السؤال انا حليتو بس وقفت عند لما يقولي السعر اكبر من 500 ماعرفت اسوي خصم للضريبه
6. Write a program that print the final price of purchase at a store where everything costs exactly one dollar. Ask for the number of items purchased. Compute a sales tax of:
• 8 percent if the users purchase is less than $100
• 7.5 percent if the purchase is greater or equal to $100.
• //Also if the purchase is over $500, give the customer an additional 10 percent after-tax discount.
• Print the purchase price, the amount of tax, the amount of the discount ($0.00 if no discount applies) and the total price.
• Output:
Enter number of items purchased= 60
the purchase price= 60 $
the amount of tax= 4.8
the total price= 64.8 $
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main ( )
{
int x,y;
printf("Enter Number of item purchased=");
printf("\n==============================\n");
scanf("%d",x);
printf("The prise = %d",x);
if(x<100)
{y=x*(8/100);
printf("The amount tax=%d",x);
printf("The total price=%d",x-y);}
else if(x>100)
{y=x*(7.5/100);
printf("The amount tax=%d",x);
print("The total price=%d",x-y);}
else if(x>500)
getch();
}وكمان عندي سؤال في ذي المتسلسله مايطلع معي ناتج الجمع صح مدري ليش يالليت احد يساعدني فيها
دي متسلسله n....... 7/1 - 6 + 5/1 - 4+3\1 -2 +1
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main ( )
{
int x=1; int N,sum=0;
printf("Enter The integer no.=");
scanf("%d",&N) ;
while(x<=N)
{if(x%2==0)
{printf("%d-",x);
sum+=x;}
else
{printf("1/%d+",x);
sum+=-1.0/x;}
x++;}
printf("\bSUM=%d",sum);
getch();
}