Welcome

>>>Welcome to my "CODE BAZAR"
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others

Update ✔✔✔ Upcoming programming book (.pdf) "Programming Contest (data structures and algorithms) by Md. Mahbub Hasan & "Graph Algorithms" by Safayat Asraf "****** Date: 20 March, 2019****Hazrat Ali****

Thursday, 10 November 2016

URI-1013

URI Online Judge | 1013

The Greatest

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
Problem link Click here
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
217 14 6217 eh o maior

Solution....

#include<stdio.h>

int main(){

    int a,b,c,ab,abc;
    scanf("%d %d %d",&a,&b,&c);

    ab=(a+b+abs(a-b))/2;
    abc=(ab+c+abs(ab-c))/2;

    printf("%d eh o maior\n",abc);

    return 0;
}

No comments:

Post a Comment