Computer Science, asked by reddynvdarshannv, 2 months ago

write c++ program for the greatest of 3 number​

Answers

Answered by anindyaadhikari13
0

Answer:

This is the required C++ program for the question.

#include <iostream>

using namespace std;

int main() {

int a,b,c;

cout << "Enter first number: ";

cin >> a;

cout << "Enter second number: ";

cin >> b;

cout << "Enter third number: ";

cin >> c;

cout << "The largest number is: "<< max(a,max(b,c));

return 0;

}

max() function returns the maximum of two numbers. max(b,c) returns the maximum of b and c. The result is then compared with a and then the maximum value of a, b and c is calculated.

Refer to the attachment for output.

•••♪

Attachments:
Similar questions