F A simple program thats calculate GCD in C programming | CodeTheta

A simple program thats calculate GCD in C programming

January 18, 2014

/* http://native-code.blogspot.com */
/* GCD_nativecode */
#include<stdio.h>
#include<conio.h>
int gcd(int m,int n)
{
 if(m>=n && (m% n) == 0)

    return n;
    else
    return(n,m%n);

}
void main()
{

 int m,n;
 printf("/* http://native-code.blogspot.com */\n\n enter m and n: ");
 scanf("%d%d",&m,&n);
 printf("\n gcd is=%d",gcd(m,n));
 getch();
 }

Post a Comment