Hackerrank solution Compare the triplets - Algorithms Warmup - Online Judge Solution

Latest

It is a free Online judges problems solution list. Here you can find UVA online Judge Solution, URI Online Judge Solution, Code Marshal Online Judge Solution, Spoz Online Judge Problems Solution

Saturday, May 6, 2017

Hackerrank solution Compare the triplets - Algorithms Warmup

Hackerrank solution Compare the triplets - Algorithms Warmup


HackerRank Online Judge Solution  Compare the triplets | Algorithms Warmup
HackerRank Main Problem Link -

Problem Name: HackerRank Problem Compare the triplets | Algorithms Warmup
Problem Number : HackerRank Problem Compare the triplets | Algorithms Warmup  Solution


Online Judge : HackerRank Online Judge Solution
Category: Algorithm
Solution Language : C, C plus plus

Hackerrank solution Compare the triplets - Algorithms Warmup

HackerRank Solution Compare the triplets | Algorithms Warmup  Code in C,CPP:


#include <stdio.h>

int main() {
    int a0, a1, a2;
    scanf("%d %d %d", &a0, &a1, &a2);
    int b0, b1, b2;
    scanf("%d %d %d", &b0, &b1, &b2);
    
    
    int a=0,b=0;
    
    if(a0>b0)
        a++;
    else if(a0<b0)
        b++;
        
    if(a1>b1)
        a++;
    else if(a1<b1)
        b++;
        
    if(a2>b2)
        a++;
    else if(a2<b2)
        b++;
        
   printf("%d %d\n", a,b);
    
    return 0;
}

1 comment: