Pagini recente » Cod sursa (job #1896458) | Cod sursa (job #1806173) | Cod sursa (job #431103) | tema | Cod sursa (job #2460311)
#include <iostream>
#include <fstream>
using namespace std;
bool cmmdc(int a, int b)
{
int d;
while(a!=b)
{
if(a>b)
a=a-b;
else
b=b-a;
}
cout<<a<<endl;
if(a==1)
return true;
else
return false;
}
int main()
{
ifstream fin("fractii.in");
ofstream fou("fractii.out");
int n,nr;
fin>>n;
nr=0;
if(n>2)
{
for(int i=1;i<=n;++i)
{
for(int j=1;j<=n;++j)
{
if(cmmdc(i,j)==true)
{
cout<<i<<"/"<<j<<endl;
nr++;
}
}
}
}
cout<<nr;
fou<<nr;
return 0;
}