Learn about Calculate the Net Amount using if else Program in C in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.
Contents
Calculate the Net Amount using if else Program in C
Source code:
#include<stdio.h>
int main()
{
double amount, finalamount;
int discount;
printf("Enter the total Amount: ");
scanf("%lf",&amount);
if(amount>=1000)
{
discount = (amount * 10)/100;
}
else
{
discount = (amount * 5)/100;
}
finalamount = amount - discount;
printf("Total payable amount = %.2f", finalamount);
return 0;
}
Output:
Enter the total Amount: 12000
Total payable amount = 10800.00
Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.
Similar Codes :
Check Character is an Alphabet or not using if else program in C
Check Character is a Lowercase Alphabet or Not using If Else Program in C