728x90 AdSpace

Latest Article



Program find GCD Example Code in C C++ For Loop while loop





Program find GCD Example Code in C C++ with Loop

#include<stdio.h>
#include<conio.h>
int gcd(int,int);
void main()
{
clrscr();
int num1,num2;
printf("enter the numbers\n");
scanf("%d%d",&num1,&num2);
printf("the gcd is=%d",gcd (num1,num2));
getch();
}
int gcd(int a,int b)
{
int i,h,k;
if(a<b)
h=a;
else
h=b;
for(i=1;i<=h;i++)
{
if(a%i==0 && b%i==0)
k=i;
}
return(k);
}

no image
  • Title : Program find GCD Example Code in C C++ For Loop while loop
  • Posted by :
  • Date : 07:38
  • Labels :






  • Blogger Comments
  • Facebook Comments

0 comments:

Post a Comment