C++ Program to find maximum among two numbers [DEVCPP/GCC]


//Program to find maximum among two numbers

#include <iostream>

using namespace std;

int main()
{
float a,b,max;

cout<<"ENTER FIRST NUMBER: ";
cin>>a;
cout<<"ENTER SECOND NUMBER: ";
cin>>b;

max = (a>b) ? a : b ;
// Variable =  <condition>  ?  <True>  :  <False> 

cout<<"\nMAXIMUM AMONG "<<a<<" & "<<b<<" IS "<<max;

return 0;
}


Share this

Related Posts

FIND US ON FACEBOOK!