C++ program to find greatest / largest among three numbers using if else.

#include<iostream.h>
void main(){
float a,b,c;
cout<<"Enter Three Numbers"<<endl;
cin>>a>>b>>c;
if(a>b){
if(a>c){
cout<<a<<" is greatest"<<endl;
}
else{
cout<<c<<" is greatest"<<endl;
}
}
else{
if(b>c){
cout<<b<<"is greatest";
}
else{
cout<<c<<"is greatest";
}
}
}

No comments:

Post a Comment