Assignments » Flow Of Control » Set 1 » Solution 3

Image result for c++ programs examples

#include<iostream>
using namespace std;


int main()
{
 int totalexp, qty, price, discount;

 cout<<"Enter quantity:";
 cin>>qty;
 cout<<"Enter price:";
 cin>>price;

 totalexp=qty*price;

 if(totalexp>5000)
 {
  discount=(totalexp*0.1);
  totalexp=totalexp-discount;
 }

 cout<<"Total Expense is  Rs. "<<totalexp;


 return 0;
}


Post a Comment

 
Top