#include <cstdlib>
#include <iostream>
using namespace std;
class kfb {
public:
void data();
void rumus1();
void cetak();
private:
int i,kpk;
int m,n,r;
};
void kfb::data(){
cout << "Masukkan nilai A : ";
cin >> m;
cout << "Masukkan nilai B : " ;
cin >> n;
}
void kfb::rumus1(){
r = m%n;
while (r!=0)
{
m = n;
n = r;
r = m%n;
}
}
void kfb::cetak(){
cout <<"FPB A dan B adalah : "<<n<<endl;
}
int main(int argc, char *argv[])
{
kfb a;
a.data();
a.rumus1();
cout<<endl;
a.cetak();
system("PAUSE");
return EXIT_SUCCESS;
}
Tidak ada komentar:
Posting Komentar