UVA Solution 408 - Uniform Generator - Solution in C | Volume 4 - 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

Sunday, May 7, 2017

UVA Solution 408 - Uniform Generator - Solution in C | Volume 4

UVA Solution 408 - Uniform Generator - Solution in C, C++ | Volume 4

UVA Online Judge Solution 408 - Uniform Generator | Volume 4
UVA Problem Link - https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=6&page=show_problem&problem=349

Problem Name: 408 - Uniform Generator
Problem Number : UVA - 408 - Uniform Generator
Online Judge : UVA Online Judge Solution
Volume: 4
Solution Language : C

UVA Solution 408 - Uniform Generator - Solution in C, C++ | Volume 4


UVA Solution 408 - Uniform Generator  Code in C:

#include <stdio.h>
int gcd(int x, int y) {
    int t;
    while(x%y) {
        t = x, x = y, y = t%y;
    }
    return y;
}
int main() {
    int a, b;
    while(scanf("%d %d", &a, &b) == 2) {
        if(gcd(a, b) == 1)
            printf("%10d%10d    Good Choice\n", a, b);
        else
            printf("%10d%10d    Bad Choice\n", a, b);
        puts("");
    }
    return 0;
}

No comments:

Post a Comment