Computer Science, asked by supriyamlulla, 3 months ago

Using C++ dev, write a program to accept two numbers from the user and display the greater of them using conditional operator

Answers

Answered by Mister360
2

Explanation:

Code:-

#include <iostream>

using namespace std;

int main()

{

int num1, num2;

cout<<"Enter first number:";

cin>>num1;

cout<<"Enter second number:";

cin>>num2;

if(num1>num2)

{

cout<<"First number "<<num1<<" is the largest";

}

else

{

cout<<"Second number "<<num2<<" is the largest";

}

return 0;

}

  • Output attached above

Attachments:
Similar questions