Cod sursa(job #828801)

Utilizator hiticas_abelhiticasabel hiticas_abel Data 4 decembrie 2012 14:33:48
Problema Fractii Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 kb
#include<fstream>
#include<iostream>
using namespace std;



int cmmdc(int a,int b)
{
    int c;
    
    while(b)
    {
    c=a%b;
    a=b;
    b=c;        
    }
return a;

}


int main()
{
ifstream f("fractii.in");
ofstream g("fractii.out");

int n,i,j,cc=0;
f>>n;
 cout<<n;


for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
if(cmmdc(i,j)==1)
   cc++;
   
   g<<cc;
  

//system("pause");
return 0;
}