Solution | URI Online Judge | 1013 The Greatest
URI Online Judge | 1013
The Greatest
Adapted by Neilor Tonin, URI
Brazil
Timelimit: 1
Brazil
Make a program that reads 3 integer values and present the greatest one followed by the message "eh o maior". Use the following formula:

Input
The input file contains 3 integer values.
Output
Print the greatest of these three values followed by a space and the message “eh o maior”.
| Input Samples | Output Samples |
| 7 14 106 | 106 eh o maior |
| 217 14 6 | 217 eh o maior |
সল্যুশন্সঃ
#include<iostream>
using namespace std;
main()
{
int a, b, c;
cin >> a >> b >> c;
if (a > b)
{
if (a > c)
{
cout << a << " eh o maior" << endl;
}else
{
cout << c << " eh o maior" << endl;
}
}else if (b > c)
{
if (b > a)
{
cout << b << " eh o maior" << endl;
}else
{
cout << a << " eh o maior" << endl;
}
}else if (c > a)
{
if (c > b)
{
cout << c << " eh o maior" << endl;
}else
{
cout << b << " eh o maior" << endl;
}
}
return 0;
}
আলোচনাঃ
কোনো টপিক না বুঝলে অবশ্যই কমেন্টস করবেন। কোড কপি পেষ্ট না করে আগে বুঝুন দেন নিজে নিজে করুন। কোডিং এর মজা টা বুঝবেন।
Comments
Post a Comment