Program to calculate bill

This program will accept item name, quantity and rate and then it will calculate the total amount by multiplying “q” and “r”.

Then the program will calculate discount in the following conditions.
1. If the amount is less then 1000 Rs. then the discount will be 5 percent,
2. If the amount is greater then equals to 1000 Rs then the discount will be 10 percent. Finally, it will calculate the net amount.

#include<iostream.h>
#include<conio.h>

void main() 
{
clrscr();
char iname[20];
float q,r,a,dis,na;

 cout << "Enter Item Name " ;
 cin >> iname;

 cout << "Enter quantity";
 cin >> q;

 cout << "Enter rate";
 cin >> r;

  a=q*r;

 cout << endl << "Total Amount is " << a;

 if (a < 1000)
 {
  dis=a*5/100;
  cout << endl << "Discount is " << dis;

 }

  if (a >= 1000)
  {
  dis = a*10/100;
  cout << endl << "Discount is " << dis;
  }
  na=a-dis;
  cout << endl << "Net amount is " << na;

getch();
}

Leave a Reply