# include <iostream.h>
main ()
{
int Bil1,Bil2,nilai,i,temp,j,Nbil1,Nbil2;
nilai=0;
cout<<"# Masukkan bilangan pertama ="; cin>>Bil1;
temp=0;
j=Bil1;
Nbil1=Bil1;
for(i=1;i<=10;i++)
{
Nbil1=Nbil1+temp;
temp=j;
cout<<Nbil1<< ' ';
}
cout<<"\n# Masukkan bilangan kedua =";cin>>Bil2;
temp=0;
j=Bil2;
Nbil2=Bil2;
for(i=1;i<=10;i++)
{
Nbil2=Nbil2+temp;
temp=j;
cout<<Nbil2<<' ';
}
for(int x=1;x<=Bil2;x++)
{
nilai=nilai+Bil1;
if(nilai % Bil2==0)
{
cout<<"\nKPK/kelipatan terkecil Antara "<<Bil1<<" dan "<<Bil2<<" Adalah="<<nilai;
cout<<"\n# Thank You # ";
x=Bil2;
}
}
}
Tampilan
0 50 Kometar:
Posting Komentar