Pagini recente » Cod sursa (job #3199179) | Cod sursa (job #1547187) | Cod sursa (job #139352) | Cod sursa (job #2615702) | 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;
}