Ans 8. Write a C Program to input shopping amount and calculate discount, if amount is greater than or equals to 1000 than 15% discount is given otherwise 5%. 1
#include<stdio.h>
int main()
{
float amount, d, n;
printf("Enter shopping amount:");
scanf("%f",&amount);
if(amount>=1000)
{
d=amount*15/100;
}
else
{
d=amount*5/100;
}
printf("Discount = %.2f",d);
n=amount-d;
printf("\nNet Amount = %.2f",n);
return 0;
}