Cod sursa(job #1347261)
Utilizator | Data | 18 februarie 2015 21:14:29 | |
---|---|---|---|
Problema | Cel mai lung subsir comun | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.24 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
int a,b;
ifstream f("cmmdc.in");
ofstream g("cmmdc.out");
f>>a>>b;
while (a!=b)
{
if(a>b)
a=a-b;
else
b=b-a;
}
g<<b;
return 0;
}