Cod sursa(job #2714106)

Utilizator andrei22georgeAndrei-George Iclodean andrei22george Data 1 martie 2021 12:17:55
Problema Cifra Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.37 kb
#include <iostream>
#include <iostream>
#include <fstream>
using namespace std;

ifstream fin ("cmmdc.in");
ofstream fout ("cmmdc.out");

int main()
{
    int a,b,r;
    fin>>a>>b;
    r=a%b;
    while (r)
    {
        a=b;
        b=r;
        r=a%b;
    }
    if (b==1) fout<<0;
    else fout<<b;

    fin.close ();
    fout.close ();
    return 0;
}