Cod sursa(job #2860624)
Utilizator | Data | 2 martie 2022 20:50:05 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.28 kb |
#include <fstream>
using namespace std;
ifstream f("euclid2.in");
ofstream ft("euclid2.out");
long long a,b,r;
int main()
{
f>>a>>b;
if(a<b) swap(a,b);
r=a%b;
while(r!=0)
{
a=b;
b=r;
r=a%b;
}
ft<<b;
}