Sign in to follow this  
Cornel Iulian

[C] CMMDC pentru toate perechile de numere intregi

1 post in this topic

Cerinta:  Pentru toate perechile distincte de numere intregi, inferioare unui n preluat de la consola, sa se afiseze cmmdc al acestora.


int main()
	int n,i,j;
	printf("Introduceti o valoare pozitiva lui N: ");
		printf("Date eronate");
		printf("N<=0. Introduceti o valoare pozitiva.");	
	for (i=1;i<=n;i++)
		for (j=i+1;j<=n;j++)
				int a=i,b=j,r;
				while (b!=0)
				printf("CMMDC(%d, %d)= %d\n",i,j,a);
	return 0;


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this