Thursday, February 28, 2019

GCD OF TWO NUMBERS C LANGUAGE CODE


Program code:
#include<stdio.h>
void main()
{
 int m,n,i,g;
 printf("enter the first element");
 scanf("%d",&m);
 printf("enter the second element");
 scanf("%d",&n);
 for(i=1;i<=m;i++)
 {
  if(m%i==0&&n%i==0)
  {
   g=i;
  }
 }
 printf("%d",g);
}

No comments:

Post a Comment