Write a program to input the total amount in a bill, if the amount is greater than 5000, then the discount will be 10%. Otherwise, no discount will be given.
Write a program to input the total amount in a bill, if the amount is greater than 5000, then the discount will be 10%. Otherwise, no discount will be given.
#include<stdio.h>
#include<conio.h>
void main()
{
float amount,discount,netdiscount,netamount;
clrscr();
printf("Enter the amount: ");
scanf("%f",&amount);
discount=0.0;
if(amount>=5000)
discount=10.0/100.0;
netdiscount=amount*discount;
netamount=amount-netdiscount;
printf("Net discount=%f",netdiscount);
printf("\nNet amount=%f",netamount);
getch();
}
Output:
run 1:
Enter the amount: 6000
Net discount=600.000000
Net amount=5400.000000
run 2:
Enter the amount: 4999
Net discount=0.000000
Net amount=4999.000000
No comments: