#include<stdio.h>
#include<conio.h>
#include<process.h>
int gcd(int m,int n)
{
int rem;
while(n!=0)
{
rem=m%n;
m=n;
n=rem;
}
return(m);
}
main()
{
int num1,num2,num3,gcd1,gcd2;
clrscr();
printf("Enter three positive integers");
scanf("%d%d%d",&num1,&num2,&num3);
if(num1==0 && num2==0 && num3==0)
{
printf("\n Invalid number");
exit(0);
}
gcd1=gcd(num1,num2);
gcd2=gcd(num3,gcd1);
printf("\n GCD of %d %d %d is : %d\n",num1,num2,num3,gcd2);
getch();
}
Not Satisfied ? Just search & get the result
Related posts:
- C program to find the GCD and LCM of two integers output the results along with the given integers. Use Euclids’ algorithm
- Sample – Program to enter an integer and output it in the reversed form.
- C program to accept a decimal number and conert it binary and count the number of 1′s in the binary number
- Sample – Program to convert 2-digit octal number into binary number and print it.
- C program to convert the given binary number into decimal

{ 1 comment… read it below or add one }
C program – Calculate the greatest Common Divisor (GCD) of a number is a good article