Pagini recente » Cod sursa (job #3221158) | Cod sursa (job #1456895) | Cod sursa (job #832320) | Cod sursa (job #477362) | Cod sursa (job #2237922)
#include <iostream>
#include <fstream>
using namespace std;
int cmmdc(int a, int b)
{
int c=1900;
if (a<b) swap(a, b);
while(c>0)
{
c=a%b;
a=b;
b=c;
}
return a;
}
int main()
{
ifstream fin("fractii.in");
ofstream fout("fractii.out");
int n, ct=0;
fin>>n;
for (int k=2; k<=n; k++)
{
for (int t=2; t<=n; t++)
{
if (cmmdc(k, t)==1){ ct++;}
}
}
ct+=(2*n-1);
fout<<ct;
}