Pagini recente » Rating stefan Neacsu (cutu12) | Cod sursa (job #2751484) | Cod sursa (job #2701974) | Cod sursa (job #3141575) | Cod sursa (job #744090)
Cod sursa(job #744090)
#include<fstream>
int main(void)
{
std::ifstream ifs;
std::ofstream ofs;
ifs.open("euclid2.in");
ofs.open("euclid2.out");
int n, a, b;
int temporar;
ifs >> n;
for (int contor = 1; contor <= n; contor++)
{
ifs >> a >> b;
temporar = a % b;
while(temporar)
{
a = b;
b = temporar;
temporar = a % b;
}
ofs << b << std::endl;
}
return 0;
}