Cod sursa(job #1029022)

Utilizator sance94FMI Nemes Sandor sance94 Data 14 noiembrie 2013 22:13:24
Problema Algoritmul lui Euclid Scor 0
Compilator c Status done
Runda Arhiva educationala Marime 0.4 kb
#include <stdio.h>
#include <stdlib.h>
int euclid(int a, int b)
{
    if (b == 0) return a;
    else
       return euclid(b, a % b);
}

int main()
{
    FILE *f,*g;
    int x,y,n,i;
    f=fopen("in.txt", "r");
    g=fopen("out.txt", "w");
    fscanf(f,"%d",&n);
    for(i=0; i<n; i++)
    {
        fscanf(f,"%d %d",&x,&y);
        fprintf(g,"%d",euclid(x,y));
    }
    return 0;
}