Question 3:Write C++ Program to Find Largest Number among Three Numbers
Solution
#include<iostream>
using namespace std;
int main(){
float a,b,c;
cout<<"\nC++ PROGRAM TO CHECK THE GREATEST NUMBER\n\n";
cout<<"Enter the first number\n";
cin>>a;
cout<<"Enter the second number\n";
cin>>b;
cout<<"Enter the third number\n";
cin>>c;
if(a>b && a>c){
cout<<"The first number which is " <<a<< " is the largest than "<<b<<" and "<<c<<endl;
}else if(b>a && b>c){
cout<<"The second number which is " <<b<< " is the largest than "<<a<<" and "<<c<<endl;
}else{
cout<<"The last number which is " <<c<< " is the largest than "<<b<<" and "<<a<<endl;
}
return 0;
}
PLEASE LEAVE A COMMENT, OR ANY OTHER QUESTIONS INVOLVING ANY OF THE FOLLOWING LANGUAGES, C++, PHP, JAVASCRRIPT, HTML, CSS, MYSQL
No comments:
Post a Comment