Cod sursa(job #2069923)
Utilizator | Data | 18 noiembrie 2017 22:55:33 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.34 kb |
#include <fstream>
using namespace std;
ifstream f("euclid2.in");
ofstream g("euclid2.out");
int cmmdc(int a,int b){
int r;
r=a%b;
while(r){
a=b;
b=r;
r=a%b;
}
return b;
}
int main()
{
int n,x,y;
f>>n;
while(n){
f>>x>>y;
g<<cmmdc(x,y)<<'\n';
n--;
}
return 0;
}