Disini saya akan mencoba-coba membuat n merevisi sebuah program c++ untuk menghitung KPK,
maaf jika masih ada kurangnya atau salahnya,,,
#include <iostream.h>
#include <conio.h>
class kpk
{
public:
int input();
void output();
private:
int a,b,c;
int nilai;
};
int kpk::input()
{
cout<<"Masukkan Nilai A : "; cin>>a;
cout<<"Masukkan Nilai B : "; cin>>b;
nilai=0;
{
for(int x=1;x<=b;x++)
{
nilai=nilai+a;
if(nilai % b==0)
}
}
int kpk::output()
{
cout<<"KPK Antara "<<a<<" dan "<<b<<" Adalah "<<nilai;
break;
}
int main()
{
nilai bilangan;
bilangan.proses();
bilangan.output();
getch();
}
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment