SOURCE CODE OUTPUT
#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cout<<"Enter the age of Ram ";
cin>>a;
cout<<"Enter the age of Sham ";
cin>>b;
cout<<"Enter the age of Ajay ";
cin>>c;
if(a<b && a<c)
cout<<"\nRam is younger of three";
else if(b<a && b<c)
cout<<"\nSham is younger of three";
else if(c<a && c<b)
cout<<"\nAjay is younger of three";
if(a==b && a<c)
cout<<"\nRam and Sham are of same age and are younger than Ajay";
else if(b==c && b<a)
cout<<"\nSham and Ajay are of same age and are younger than Ram";
else if(c==a && c<b)
cout<<"\nAjay and Ram are of same age and are younger Sham";
else if(c==a && c==b)
cout<<"All three of them have same age ";
cout<<endl;
return 0;
}
using namespace std;
int main()
{
int a,b,c;
cout<<"Enter the age of Ram ";
cin>>a;
cout<<"Enter the age of Sham ";
cin>>b;
cout<<"Enter the age of Ajay ";
cin>>c;
if(a<b && a<c)
cout<<"\nRam is younger of three";
else if(b<a && b<c)
cout<<"\nSham is younger of three";
else if(c<a && c<b)
cout<<"\nAjay is younger of three";
if(a==b && a<c)
cout<<"\nRam and Sham are of same age and are younger than Ajay";
else if(b==c && b<a)
cout<<"\nSham and Ajay are of same age and are younger than Ram";
else if(c==a && c<b)
cout<<"\nAjay and Ram are of same age and are younger Sham";
else if(c==a && c==b)
cout<<"All three of them have same age ";
cout<<endl;
return 0;
}
Any questions regarding to program please write in comments.
No comments:
Post a Comment