Wednesday, 8 July 2015

How to find largest number in C++

#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cout<<"Enter first Value: ";
cin>>a;
cout<<"\nEnter second Value: ";
cin>>b;
cout<<"\nEnter third Value: ";
cin>>c;
if(a>b && a>c){
cout<<"Largest Number is: "<<a;
}else
if(b>a && b>c){
cout<<"Largest Number is: "<<b;
}else
if(c>b && c>a){
cout<<"Largest Number is: "<<c;
}else
cout<<"\n\n\t\tAll number are equal";
}

0 comments:

Post a Comment