C Program to find GCD

#include <stdio.h>

#include<conio.h>

void main()

{

    int n1, n2, i, gcd;

    clrscr();

    printf("Enter two integers\n");

    scanf("%d %d", &n1, &n2);

    for(i=1; i <= n1 && i <= n2; ++i)

    {

          if(n1%i==0 && n2%i==0)

          gcd = i;

    }

    printf("G.C.D of %d and %d is %d", n1, n2, gcd);

    getch();

}


Output


Enter two positive integers: 

25

57

G.C.D of 25 and 57 is 1