Cod sursa(job #2001791)

Utilizator stefan_creastaStefan Creasta stefan_creasta Data 17 iulie 2017 18:55:14
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.33 kb
#include <cstdio>
using namespace std;

int main()
{
    int a, b, r;
    freopen("cmmdc.in","r",stdin);
    freopen("cmmdc.out","w",stdout);
    scanf("%d%d", &a, &b);
    while(b) {
        r = a % b;
        a = b;
        b = r;
    }
    if(a == 1) {
        a = 0;
    }
    printf("%d\n", a);
    return 0;
}