Cod sursa(job #1587046)
Utilizator | Data | 1 februarie 2016 19:40:30 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.26 kb |
#include<iostream>
#include<fstream>
using namespace std;
ifstream f("euclid2.in");
ofstream g("euclid2.out");
int main()
{int T,a,b;
f>>T;
while(a)
{f>>a>>b;
while(a!=b)
{if(a>b)
{a=a-b;}
else
{b=b-a;}}
g<<a<<"\n";}
f.close();
g.close();
return 0;}