Monday, June 18, 2012

To calculate the discount; if available


/* To calculate the discount; if available */

#include<stdio.h>

#include<conio.h>

void main()

{

 int qty;

 float dis=0,rate,amt;

 clrscr();

 printf("Enter the quantity of the required item: ");

 scanf("%d",&qty);

 printf("\nEnter the price of the item: ");

 scanf("%f",&rate);

 /* To check if discount is available */

 if(qty>=1000)

 {

   dis=10;

 }

 amt=qty*rate-qty*rate*dis/100;

 printf("\nTotal expenses=%f",amt);

 getch();

}

 

OUTPUT

Enter the quantity of the required item: 1340

 

Enter the price of the item: 6.45

Total expenses=7778.699707

 

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.