Header add

 In this article we discussed about C Program to Find GCD of two Numbers using for loop and if Statement. The HCF or GCD of two integers is the largest integer that can exactly divide both numbers (without a remainder).

In this program, two integers entered by the user are stored in variable n1 and n2.Then, for loop is iterated until i is less than n1 and n2.

In each iteration, if both n1 and n2 are exactly divisible by i, the value of i is assigned to gcd.

When the for loop is completed, the greatest common divisor of two numbers is stored in variable gcd.

Post a Comment

Previous Post Next Post