Cod sursa(job #1125822)

Utilizator dzzankGeorge Roman dzzank Data 26 februarie 2014 19:40:57
Problema Fractii Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.51 kb
#include <fstream>

using namespace std;

ifstream in("fractii.in");
ofstream out("fractii.out");

bool ireductibila(int i,int j);

int main()
{
    int N,nr=0;

    in>>N;

    for(int i=1;i<=N;++i)
    {
        for(int j=1;j<=N;++j)
        {
            if(ireductibila(i,j))
                ++nr;
        }
    }

    out<<nr;

    in.close();
    out.close();

    return 0;
}

bool ireductibila(int i,int j)
{

    if(i!=1 && j!=1 && (i%j==0 || j%i==0))
        return 0;

}