Cod sursa(job #2640476)

Utilizator ofy_ddOvidiu Oprea ofy_dd Data 6 august 2020 16:14:57
Problema Algoritmul lui Euclid Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.34 kb
#include <iostream>
#include <fstream>
using namespace std;

int main()
{
   ifstream f("euclid.in");
   ofstream g("euclid.out");
   int n;
   int x, y, z;
   for(int i=1; i<=n; i++)
   {
       f >> x >> y;
       while(x!=y)
       {
           z = x%y;
           x = y;
           y = z;
       }
       g << x << "\n";
   }     
    return 0;
}