Cod sursa(job #1379225)

Utilizator cristy801Cristi Chirtos cristy801 Data 6 martie 2015 17:04:39
Problema Fractii Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.51 kb
#include <fstream>

using namespace std;

int main()
{
    ifstream f("fractii.in");
    ofstream g("fractii.out");
    int i,n,s=0,j,cj,ci,r;
    f>>n;
    i=1;
    while(i<=n)
    {
        j=1;
        while(j<=n)
        {
            ci=i;cj=j;
            while(cj>0)
            {
                r=ci%cj;
                ci=cj;
                cj=r;
            }
            if(ci==1)
                ++s;
            ++j;
        }
        ++i;
    }
    g<<s;
    return 0;
}