source code name: discount.C
void main()
{
int qty,rt,amt,amtpaid;
int dis=0;
clrscr();
printf(" enter quantity and rate of items: \n");
scanf("%d%d",&qty,&rt);
amt=qty*rt;
if(amt>=1000)
dis=amt*0.1;
else
printf("\n sorry no discount , purchase some items ");
amtpaid=amt-dis;
printf(" \n actually paid amount=%d & discount gained = %d ",amtpaid, dis);
getch();
}
output:
1) enter quantity and rate of items: 100 25
actually paid amount=2250 & discount gained =250
2) enter quantity and rate of items: 20 40
sorry no discount , purchase some items
actually paid amount=800 & discount gained =0
0 Comments
Post a Comment