GCF

#include<stdio.h>
#include<conio.h>
void main()
{
int gcf(int,int);
int a,b,g;
clrscr();
printf("Enter any to Number");
scanf("%d %d",&a,&b);
g=gcf(a,b);
printf("Greatest common factor=%d",g);
getch();
}
int gcf(int first,int second)
{
int t;
while(second>0)
     {
     t=first % second;
     first=second;
     second=t;
     }
return(first);
}

No comments:

Related Posts with Thumbnails