Answer to Question #152421 in C++ for Usama Saleem

Question #152421
a program which takes as input two integers and then displays the maximum of the two numbers. You HAVE to use a ternary operator for this purpose.
1
Expert's answer
2020-12-22T04:15:44-0500
#include <iostream>


int main() {
	int first, second;
	std::cout << "Enter first number: ";
	std::cin >> first;
	std::cout << "Enter second number: ";
	std::cin >> second;
	std::cout << "max :" << (first > second ? first : second) << std::endl;//displays the maximum of the two numbers
	system("pause");
	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

LATEST TUTORIALS
New on Blog