KPK
#include <stdio.h>
int kpk(int a,int b)
{
int i;
int hasil = 0;
if(a<b)
{
i = a;
a = b;
b = i;
}
do
{
hasil = hasil+b;
}while(hasil % a != 0);
return hasil;
}
int main()
{
int a, b;
printf("MASUKAN NILAI A: \n");
scanf("%d",&a);
printf("Masukan nilai B : \n");
scanf("%d",&b);
printf("%d",kpk(a,b));
}
Komentar
Posting Komentar