Program
#include<stdio.h>
int main()
{
printf("*******************************************");
printf("\n*******************************************");
printf("\n**WAP to calculate discount based on bill**");
printf("\n** using if else if laddar **");
printf("\n** Created by Sheetal Garg **");
printf("\n** Assistant Professor **");
printf("\n** Phone No:9467863365 **");
printf("\n*******************************************");
printf("\n*******************************************\n");
float price, quan, dis, bill, netpay;
printf("enter quantity and price");
scanf("%f%f",&quan, &price);
bill = quan*price;
if(bill<500)
dis=0;
else if (bill>=500 && bill<1000)
dis= bill*0.05;
else if(bill>=1000 && bill<2000)
dis= bill*0.10;
else
dis=bill*0.20;
netpay= bill-dis;
printf("you have to pay %f",netpay);
return 0;
}
Output 1 (No Discount)
******************************************* ******************************************* **WAP to calculate discount based on bill** ** using if else if laddar ** ** Created by Sheetal Garg ** ** Assistant Professor ** ** Phone No:9467863365 ** ******************************************* ******************************************* enter quantity and price 100 2 you have to pay 200.000000
Output 2(5% Discount)
******************************************* ******************************************* **WAP to calculate discount based on bill** ** using if else if laddar ** ** Created by Sheetal Garg ** ** Assistant Professor ** ** Phone No:9467863365 ** ******************************************* ******************************************* enter quantity and price 100 5 you have to pay 475.000000
Output 3 (10% Discount)
******************************************* ******************************************* **WAP to calculate discount based on bill** ** using if else if laddar ** ** Created by Sheetal Garg ** ** Assistant Professor ** ** Phone No:9467863365 ** ******************************************* ******************************************* enter quantity and price 100 10 you have to pay 900.000000
Output 4(20% Discount)
******************************************* ******************************************* **WAP to calculate discount based on bill** ** using if else if laddar ** ** Created by Sheetal Garg ** ** Assistant Professor ** ** Phone No:9467863365 ** ******************************************* ******************************************* enter quantity and price 100 20 you have to pay 1600.000000