This program asks the user to input two numbers and outputs the greatest of the two numbers.
#include <iostream.h>
void main()
{
int a,b;
cout << "Enter a number : ";
cin >> a;
cout << "\nEnter another number : ";
cin >> b;
cout << "The largest number is : " << a>b:a?b;
}
If you need explanations, just comment. :D
#include <iostream.h>
void main()
{
int a,b;
cout << "Enter a number : ";
cin >> a;
cout << "\nEnter another number : ";
cin >> b;
cout << "The largest number is : " << a>b:a?b;
}
If you need explanations, just comment. :D
No comments:
Post a Comment