include <stdio.h>
#include <iostream.h>
#include <conio.h>
int fpb(int x, int y ){
int z,a;
if (y<=x && x%y==0){
return(y);
}else{
if (x<=y && y%x==0){
return(x);
}else{
if (x<y) {
z = fpb(y,x);
return(z);
}else{
a=x%y;
z=fpb(y,a);
return(z);
}
}
}
}
main(){
int m,n;
cout << " bilang 1 = "; cin >> m;
cout << " bilang 2 = "; cin >> n;
cout << " FPB = "<< fpb(m,n);
getch();
}
0 komentar:
Posting Komentar