PROGRAM TO CALCULATE DISCOUNT & TOTAL EXPENSE

C, C++, etc Programing examples. Post as many you can. Test the programs and discuss about the output of the programes.
Forum rules
Please Discuss & post only about the programes and its Output

PROGRAM TO CALCULATE DISCOUNT & TOTAL EXPENSE

Postby charulatha » Tue Apr 13, 2010 2:28 pm

/* CALCULATION OF TOTAL EXPENSES IN CASE OF DISCOUNT */

#include<stdio.h>
#include<conio.h>
main()
{
int qty;
float dis,price,tot_price;
printf("Enter the quantity and price of the item\n");
scanf("%d%f",&qty,&price);
if(qty>1000)
{dis=(float)0.1;
tot_price=(qty*price)-(qty*price*0.1);
printf("Total expense=%.2f",tot_price);
}
else
{tot_price=qty*price;
printf("Total expense=%.2f\n",tot_price);
}
getch();
}
Regards,
Charulatha.
User avatar
charulatha
Moderator
 
Posts: 756
Joined: Sat Oct 17, 2009 2:54 pm
membership: Senior Technician of The Institution of Engineers (India)- ST

ad
 

Return to Computer Notes : Some Sample Programs

Who is online

Users browsing this forum: No registered users and 0 guests