Professional Documents
Culture Documents
#include <conio.h>
using namespace std;
int main(){
cout<<"Question no 1 \n";
//example of if statement
int rate;
cout<<"enter rate of car ";
cin>>rate; //get rate of car from user
if(rate==45000){
cout<<"confirm this car "; //if condition is equal to user rate then this statement
will display on screen
}
cout<<"\n\n\n\n"; //use this for extra vertical spaces
cout<<"Question no 2 \n";
int mark;
cout<<"Enter student mark \n";
cin>>mark;
if(mark>=90&&mark<=100){
cout<<"A+";
}
else if(mark>=80&&mark<=89){
cout<<"A";
}
else if(mark>=70&&mark<=79){
cout<<"B";
}
else if(mark>=60&&mark<=69){
cout<<"C";
}
else if(mark>=50&&mark<=59){
cout<<"D";
}
else if(mark>=0&&mark<=49){
cout<<"F";
}
cout<<"\n\n\n\n"; //use this for extra vertical spaces
cout<<"Question no 3 \n";
int item1,item2,item3,total_cost;
cout<<"Enter the price of item1 \n";
cin>>item1;
cout<<"Enter the price of item2 \n";
cin>>item2;
cout<<"Enter the price of item3 \n";
cin>>item3;
total_cost=item1+item2+item3;
if(total_cost>100){
int discount_amount,discount;
discount=0.1*total_cost; //apply this for calculate discount
cout<<"Here is a discount for you which is 10% \n";
discount_amount=total_cost-discount; //apply this for discount amount provided to
customer
cout<<"Hence "<<endl;
cout<<"Total cost before discount is "<<total_cost<<endl;
cout<<"and "<<endl;
cout<<"Total cost after discount is "<<discount_amount;
}
getch();
return 0;
}