answersLogoWhite

0

#include<stdio.h>

#include<conio.h>

int A,B,GCF=1,K,X;

main()

{

clrscr();

printf("First integer:");

scanf("%d",&A);

printf("\nSecond integer:");

scanf("%d",&B);

X=A*B;

for(K=2; A!=1 B!=1; K++)

{

while (A%K==0 && B%K==0)

{

A/=K;

B/=K;

GCF*=K;

}

while(A%K==0)

{

A/=K;

}

while(B%K==0)

{

B/=K;

}

}

printf("GCF is %d",GCF);

getch();

}

User Avatar

Wiki User

14y ago

Still curious? Ask our experts.

Chat with our AI personalities

MaxineMaxine
I respect you enough to keep it real.
Chat with Maxine
JudyJudy
Simplicity is my specialty.
Chat with Judy
JordanJordan
Looking for a career mentor? I've seen my fair share of shake-ups.
Chat with Jordan

Add your answer:

Earn +20 pts
Q: Sample program on how to get the Greatest Common Factor of the two numbers using Turbo C programming?
Write your answer...
Submit
Still have questions?
magnify glass
imp