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
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
Geography,
2 months ago
Social Sciences,
2 months ago
India Languages,
2 months ago
Social Sciences,
4 months ago
Math,
10 months ago
Hindi,
10 months ago