Cod sursa(job #2510911)

Utilizator alex2005alex chiper alex2005 Data 17 decembrie 2019 19:03:28
Problema Algoritmul lui Euclid Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.31 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("euclid2.in");
ofstream fout("euclid2.out");
 int main() {
 	int nr1, nr2;
 	fin >> nr1 >>nr2;
 	while(nr1 != nr2) {
 		if(nr1 > nr2)
 			nr1=nr1 - nr2;
 		 if(nr2 > nr1)
 		 	nr2=nr2 - nr1;



 	}
 	fout<<nr1;
 	return 0;
 }