Cod sursa(job #2009492)

Utilizator sopyCorneliu-Mihai sopy Data 9 august 2017 20:50:05
Problema Algoritmul lui Euclid Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.63 kb
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/* 
 * File:   main.cpp
 * Author: sopy
 *
 * Created on August 9, 2017, 8:08 PM
 */

#include <cstdlib>
#include <iostream>
#include <fstream>

using namespace std;

ifstream fin("euclid2.in");
ofstream fout("euclid2.out");
int temp, a, b;

/*
 * 
 */
int euclid(int a, int b) {
    int c;
    while (b) {
        c = a % b;
        a = b;
        b = c;
    }
    return a;
}

int main() {
    fin >> a >> b;
    fout << euclid(a, b) << '\n';
    return 0;
}