You are on page 1of 10

Question 1

#include <iostream.h>

using namespace std;

int main()

int number;

cout << "Enter any number" << endl;

cin>>number;

if(number%2==0)

cout<<"the number you enter is =" <<number <<" =is even"<<endl;

else{

cout<<"the number you enter is =" <<number <<"= is odd"<<endl;

return 0;

Question 2

#include <iostream>

using namespace std;

int main()

int number;

cout << "Enter any number = " << endl;

cin>>number;

if (number >0){

cout<<"The absolute value of the number is= "<<number <<endl;

else{

cout<<"The absolute value of the number is ="<<-(number)<<endl;

}
return 0;

******************************************************************************

Question 3

#include <iostream>

using namespace std;

int main()

float total,total1,quantity, price, discount;

cout << "Enter the quantity of your item" << endl;

cin>>quantity;

cout << "Enter the price of your item" << endl;

cin>>price;

total = quantity * price;

discount = total*50/100;

total1 = total - discount;

if (total > 5000){

cout<<"The total price with discount is ="<<total1<<endl;

else{

cout<<"the total price ="<<total<<endl;

return 0;

Question 4

#include <iostream>

using namespace std;

int main()

float costprice,sellingprice, profit,loss;

string item;
cout << "Enter the item you buy " << endl;

cin>>item;

cout << "Enter the cost price of the" <<" " <<item << endl;

cin>>costprice;

cout << "Enter the selling price of " <<" "<<item << endl;

cin>>sellingprice;

profit = sellingprice - costprice;

if( sellingprice > costprice )

cout << "The profit you get from " <<item<<"is =" <<" "<<profit <<"Birr" << endl;

else

cout << "The profit you get from"<<" "<<item <<"is =" <<profit <<"Birr"

<<"\n Try to improve your income you are in loss";

return 0;

Question 5

#include <iostream>

using namespace std;

int main()

int abdi ,boru, oromia;

cout << "Enter abdi's Age" << endl;

cin>>abdi;

cout << "Enter boru's Age" << endl;

cin>>boru;

cout << "Enter oromia's Age" << endl;

cin>>oromia;

if (abdi < 18 || boru <18 || oromia<18){


cout<<"All age should be greater than 18"<<endl;

else if(abdi < boru && abdi <oromia){

cout<<"Abdi is the youngest"<<endl;

else if (boru < abdi && boru < oromia){

cout<<"The youngest is Boru"<<endl;

else if (oromia<abdi && oromia < boru){

cout<<"The youngest is Oromia"<<endl;

else if (abdi == boru && abdi == oromia && boru ==oromia ){

cout<<" All of them have equal age"<<endl;

else if (abdi && boru <oromia){

cout<<" Abdi and Boru is the youngest"<<endl;

else if (abdi && oromia <boru){

cout<<"Abdi and Oromia is youngest"<<endl;

else{

cout<<"Boru and Oromia is the youngest"<<endl;

return 0;

Question 6

#include <iostream>

using namespace std;

int main()

int hypotenus ,adjacent,opposite,angle;


cout << "Enter the hypotenuse " << endl;

cin>> hypotenus;

cout << "Enter the adjacent " << endl;

cin>> adjacent;

cout << "Enter the opposite " << endl;

cin>> opposite;

angle = hypotenus + adjacent + opposite;

if (angle < 180 || angle > 180)

cout<<"the angle you entered is invalid"<<endl;

cout<<"please enter new angle"<<endl;

if(angle == 180)

cout<<"the angle is ="<<angle<<" =is valid triangle"<<endl;

return 0;

Question9

#include <iostream>

using namespace std;

int main()

int calls;

float bill;

cout << "Enter the number of calls" << endl;

cin>>calls;

if (calls <= 100){

bill =200;

else if (calls >100 && calls <=150){


calls = calls -100;

bill= 200+(0.6*calls);

else if(calls >150 && calls <=200){

calls =calls -150;

bill= 200+(0.6*50)+(0.5*calls);

else{

calls =calls - 200;

bill = 200+(0.6*50)+(0.5*50)+(0.4*calls);

cout<<"your bill is "<<bill;

return 0;

********************************************************************************

Question10

#include <iostream>

#include<math.h>

using namespace std;

int main()

float a,b,c,d,root1,root2;

cout << "Enter the value of a,b,c:" << endl;

cin>>a>>b>>c;

d=b*b-4*a*c;

if(d==0){

root1=(-b)/(2*a);

root2 =root1;

cout<<"roots are equal";


}

else if(d>0){

root1= -(b+sqrt(d))/(2*a);

root2= -(b-sqrt(d))/(2*a);

cout<<"Root are real and distinct";

else{

root1= (-b)/(2*a);

root2 =(-d)/(2*a);

cout<<"Root are imaginary";

cout<<"\n Root 1 = "<<root1 <<"\n Root 2 =" <<root2;

return 0;

Question 11

#include <iostream>

using namespace std;

int main()

float mark,percentage;

string subject1,subject2,subject3,subject4,subject5;

cout << "Enter the 1st subject " << endl;

cin>>subject1;

cout<<"Enter the mark of "<<subject1<<endl;

cin>> mark;

cout << "Enter the 2nd subject " << endl;

cin>>subject2;

cout<<"Enter the mark of "<<subject2<<endl;

cin>> mark;
cout << "Enter the 3rd subject " << endl;

cin>>subject3;

cout<<"Enter the mark of "<<subject3<<endl;

cin>> mark;

cout << "Enter the 4t subject " << endl;

cin>>subject4;

cout<<"Enter the mark of "<<subject4<<endl;

cin>> mark;

cout << "Enter the 5th subject"<< endl;

cin>>subject5;

cout<<"Enter the mark of "<<subject5<<endl;

cin>> mark;

percentage = mark *5 / 5;

if(percentage >= 60){

cout<<"your percentage is ="<<percentage<<"\n first Division"<<endl;

cout<<"Short summery"<<endl;

cout<<subject1 <<"="<< mark<<endl;

cout<<subject2 <<"="<< mark<<endl;

cout<<subject3 <<"="<< mark<<endl;

cout<<subject4 <<"="<< mark<<endl;

cout<<subject5 <<"="<< mark<<endl;

else if(percentage >59){

cout<<"your percentage is ="<<percentage<<"\n second Division"<<endl;

cout<<"Short summery"<<endl;

cout<<subject1 <<"="<< mark<<endl;

cout<<subject2 <<"="<< mark<<endl;

cout<<subject3 <<"="<< mark<<endl;

cout<<subject4 <<"="<< mark<<endl;

cout<<subject5 <<"="<< mark<<endl;

}
else if (percentage >49){

cout<<"your percentage is ="<<percentage<<"\n Third Division"<<endl;

cout<<"Short summery"<<endl;

cout<<subject1 <<"="<< mark<<endl;

cout<<subject2 <<"="<< mark<<endl;

cout<<subject3 <<"="<< mark<<endl;

cout<<subject4 <<"="<< mark<<endl;

cout<<subject5 <<"="<< mark<<endl;

else{

cout<<"your percentage is ="<<percentage<<"\n fail";

cout<<"Short summery"<<endl;

cout<<subject1 <<"="<< mark<<endl;

cout<<subject2 <<"="<< mark<<endl;

cout<<subject3 <<"="<< mark<<endl;

cout<<subject4 <<"="<< mark<<endl;

cout<<subject5 <<"="<< mark<<endl;

return 0;

********************************************************************************

Question 12

#include <iostream>

using namespace std;

int main()

char a;

int b;

cout << "Enter the character:" << endl;

cin>>a;

cout<<endl;
b= (int)a;

if(b>=48 && b<=57)

if(a%2==0)

cout<<"it is a even number";

else{

cout<<"it is an odd number";

if(b>=33 &&b<=47)

cout<<" it is a special symbol:";

else if (b>=65 && b <= 90)

cout<<"It is a upper case latter:";

else if (b>=97 && b<=122)

cout<<" it is a lower case latter:";

return 0;

You might also like