URI ONLINE JUDGE SOLUTION 1013 - The Greatest

Problem:
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”.

sample input output


Solution:

#include <stdio.h>
#include<math.h>
int main() {
    int a,b,c,ans,great;
    scanf("%d%d%d",&a,&b,&c);
    ans=(a+b+abs(a-b))/2;
    great=(c+ans+abs(c-ans))/2;
    printf("%d eh o maior\n",great);
    return 0;
}

Comments

Popular posts from this blog

URI ONLINE JUDGE SOLUTION 1021 - Banknotes and Coins

URI ONLINE JUDGE SOLUTION 1040 - Average 3

URI ONLINE JUDGE SOLUTION 1036 - Bhaskara's Formula