Cod sursa(job #255559)

Utilizator thestickTudor A thestick Data 9 februarie 2009 22:57:01
Problema Fractii Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include<fstream.h>
#include<conio.h>

long int cmmmdc(long int a, long int b)
	{while(a!=b){
		 if(a<b) b=b-a;
		 else a=a-b;
			}
	return b;
	}

	
void main(){

	long int n,i,j,a=1;
	ifstream f("fractii.in");
	ofstream g("fractii.out");
	f>>n;
	for(i=1;i<=n;i++)
		for(j=1;j<=n;j++)
			if(cmmmdc(i,j)==1 && i!=j) a++;
			
	g<<"numarul de fractii "<<a;
				
	}