Pagini recente » Cod sursa (job #983411) | Cod sursa (job #2204091) | Cod sursa (job #887538) | Cod sursa (job #252041) | Cod sursa (job #772716)
Cod sursa(job #772716)
#include <iostream>
#include <fstream>
using namespace std;
int n,ok,solutie = 0;
int verificare(int a,int b)
{
if(a%b!=0 && b%a!=0)
{
return 1;
}
else
{
return 0;
}
}
int main()
{
ifstream f("fractii.in");
ofstream g;
g.open("fractii.out");
f >> n;
for(int i=1; i<=n; i++)
{
for(int j=1; j<=n; j++)
{
g << i << " " << j << " " << ok << "\n";
if(i!=j)
{
ok=0;
ok= verificare(i,j);
if(ok==1)
{
solutie++;
}
}
if(i==1 || j==1)
{
solutie++;
}
}
}
g << solutie;
g.close();
return 0;
}