Beecrowd 1013 solution- The Greatest

Beecrowd 1013- The Greatest solution Question

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 SamplesOutput Samples
7 14 106106 eh o maior

Beecrowd 1013 solution- The Greatest solution in C

#include<stdio.h>

int main() {

int a,b,c,d;
scanf("%d%d%d",&a,&b,&c);
d=(a+b+abs(a-b))/2;
d=(d+c+abs(d-c))/2;
printf("%d eh o maior\n",d);

return 0;

}

Beecrowd 1013 solution- The Greatest solution in C++

#include<bits/stdc++.h>
using namespace std;

int main() {

int a,b,c,d;
cin>>a>>b>>c;

d=(a+b+abs(a-b))/2;
d=(d+c+abs(d-c))/2;
cout<<d<<" eh o maior"<<endl;


return 0;

}

The Greatest Solution in Python

a, b, c = map(int, input().split())

d = (a + b + abs(a - b)) // 2
d = (d + c + abs(d - c)) // 2

print(f"{d} eh o maior")

Next problem:BEECROWD 1014 – Consumption Solution

Leave a Comment