Cod sursa(job #561331)
| Utilizator | Data | 19 martie 2011 20:33:33 | |
|---|---|---|---|
| Problema | A+B | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.48 kb |
#include <iostream>
using namespace std;
#include <fstream>
void beolvas(int *a,int*b){
ifstream be ("cmmdc.in" , ifstream::in );
char l;
be>>*a;
be>>*b;
be.close();
}
int lnko(int a,int b){
while (a!=b){
if (a>b)
a=a-b;
else
b=b-a;
}
if (a==1) return 0;
else
return a;
}
void beir(int k){
ofstream ki("cmmdc.out");
ki<<k;
ki.close();
}
int main(){
int a,b;
beolvas(&a,&b);
int k;
k=lnko(a,b);
beir(k);
return 0;
}
