CS201: C++ if/else example
C++ : if /else example
Solution:
#include<iostream.h>main(){
int a=0;
int b=0;
cout<<"Please enter the value of a: ";
cin>>a;
cout<<"Please enter the value of b: ";
cin>>b;
if(a<b)
{
cout<<"a is less than b ";
cout<<endl;
}
else if(a>b)
{
cout<<"b is less than a ";
cout<<endl;
}
else if(a==b)
{
cout<<"a == b";
cout<<endl;
}
else{
cout<<"Please enter the correct value";
cout<<endl;
}
system("pause");
}
output:
by Hafiz Muhammad Umar Hayat

Comments
Post a Comment