FPB
#include <stdio.h>
int fpb(int a, int b)
{
int bagi;
bagi = a%b;
while(bagi != 0)
{
a = b; // a = 18. b= 12'
b = bagi;//6
bagi = a%b;//0
}
return b;
}
int main()
{
int a, b;
printf("MASUKAN NILAI A: \n");
scanf("%d",&a);
printf("Masukan nilai B : \n");
scanf("%d",&b);
printf("%d",fpb(a,b));
}
Komentar
Posting Komentar