Tag: GCD

  • Program to find GCD of two numbers in C language

    Program to find GCD of two numbers in C language

    The following program is to find the GCD or HCF of a number using C Language. GCD is the Greatest Common Divisor that divides a particular number. #include<stdio.h> void main(){ int a,b,i,j; printf(“\n****************************\nprogram to find GCD of 2 Numbers\n*****************************\n\n”); printf(“Enter two numbers: “); scanf(“%d%d”,&a,&b); printf(“Common Factors for %d and %d are: “,a,b); j=a>b?b:a; for(i=1;i<=j;i++){ if(a%i==0…