Answer to Question #311125 in C++ for Christine Traya

Question #311125

Design a program that will ask the user to give three numbers and then the program will determine which of the three numbers has the highest in terms of numerical value using termary operator




// maximum.cpp



// Author: Mr jake R. pomperada, BSCS, MAED- IT



// Date: august 23, 2018 Thursday 10:55 pm



// Location: Bacolod City, Negros occidental



// Website: http://www.jakerpompereda.com




1
Expert's answer
2022-03-14T08:38:51-0400
using namespace std;


int main()
{
	int a,b,c,max;
    
	cout<<"\n\tEnter First  number: "; cin>>a; 
	cout<<"\n\tEnter Second number: "; cin>>b; 
	cout<<"\n\tEnter Third  number: "; cin>>c; 
	
    // Largest among a, b and c
    max=(c>((a>b)?a:b)?c:((a>b)?a:b));
	cout << "Largest number among "<<a<<", "<<b<<" and "<<c<<" is :"<<max;


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment