Subscribe for more such posts..

Dear Reader...
I hope u are like my posts. If so then please don't forget to like , share and follow my blog for more such posts ,also feel free to write suggestions in the comment box given over here.

Thank you...

Search This Blog

C program to find the GCD of two numbers using Recursion.



 #include <stdio.h>
int GCD(int a , int b)
{
	
	
	if (b != 0)
	{
	return GCD(b , a%b );
	
	}
	else
	{
		return a ;
	}
	
	
}
 
int main ()
{
	int n1 , n2 ;
	printf("Enter two integer values : ");
	scanf("%d %d" , &n1 , &n2);
	printf("The gcd of two numbers %d and %d = %d\n" , n1 , n2 , GCD(n1, n2));
	
return 0 ;
}


No comments:

Post a Comment