Pagini recente » Cod sursa (job #1994152) | Cod sursa (job #1685345) | Cod sursa (job #1321557) | Cod sursa (job #2103641) | Cod sursa (job #2076648)
#include<iostream>
#include<fstream>
#include<math.h>
using namespace std;
ifstream f("fractii.in");
ofstream g("fractii.out");
//fractii ireductibile
unsigned int ireductibil(int x,int y)
{
int p=1;//presupunem ca e ireductibila
if(x%2==0 && y%2==0)p=0;
else if(x==y)p=0;
else if((x%2==0 && y%2==1) &&((x%y==0)||(y%x==0)))p=0;
return p;
}
int main()
{ int k=0; float n;
f>>n;
float int i,j;
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
if(ireductibil(i,j))k++;
g<<k;
return 0;
}