Cod sursa(job #1215527)
Utilizator | Data | 1 august 2014 12:07:42 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.49 kb |
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
freopen ("euclid2.in" , "r" , stdin);
freopen ("euclid2.out" , "w" , stdout);
int t;
scanf ("%d" , &t );
while (t!=0){
int a,b,r;
scanf ("%d %d" , &a ,&b);
while(b!=0){
r=a%b;
a=b;
b=r;
}
printf ("%d" , a);
printf ("\n");
--t;
}
return 0;
}