You are on page 1of 2

#include <iostream>

#include <conio.h>
using namespace std;
int main(){
//Question no 1
//example of if statement
int price;
cout<<"enter price of jacket ";
cin>>price;
if(price==450){
cout<<"buy this jacket ";
}
cout<<"\n";

//example of if-else statement


int score;
cout<<"enter score of player ";
cin>>score; //get marks of student from user
if(score>=40){
cout<<"good";
}
else{
cout<<"bad";
}
cout<<"\n";
//example of else-if statement
int shoesprice;
cout<<"Enter shoesprice ";
cin>>shoesprice;
if(shoesprice>=2000){
cout<<"any discount for me ";
}
else if(shoesprice>0&&shoesprice<2000){
cout<<"it is good price \n";
}
else {
cout<<"no need, price is high ";
}
cout<<"\n";
//Question no 2
int mark;
cout<<"Enter marks of student \n";
cin>>mark;
if(mark>=90&&mark<=100){
cout<<"A+ \n";
}
else if(mark>=80&&mark<=89){
cout<<"A \n";
}
else if(mark>=70&&mark<=79){
cout<<"B \n";
}
else if(mark>=60&&mark<=69){
cout<<"C \n";
}
else if(mark>=50&&mark<=59){
cout<<"D \n";
}
else if(mark>=0&&mark<50){
cout<<"F \n";
}
cout<<"\n";
//Question no 3
int thng1,thng2,thng3,total;
cout<<"Enter the price of 1st thing \n";
cin>>thng1;
cout<<"Enter the price of 2nd thing \n";
cin>>thng2;
cout<<"Enter the price of 3rd thing \n";
cin>>thng3;
total=thng1+thng2+thng3;
if(total>100){
int discountprice,discount;
discount=0.1*total;
discountprice=total-discount;
cout<<"Total cost before discount is "<<total<<"\n";
cout<<"Total cost after discount is "<<discountprice;
}

getch();
return 0;
}

You might also like