Printing Out Numbers are divisible by 3 and 5

So we enter the instance number is n, then n mod 3 == 0, here means if n mod 3 if the result = 0 if the result equals 0 then the number is exhausted dbagi with 3.


i: integer {bilangan 1 sampai dengan 100}


Read i
I ß 1 sampai dengan 100
for (int i=1; i<=100; i++)
if (i mod 3==0)
Write i
Else (i mod 5==0)
Write i

program C++



class bilangan



int proses();


int i;


int bilangan::proses()


cout<<"Program Mencetak Bilangan yg Habis dibagi 3 dan 5";

cout<<" antara 1 sampai 100 : \n";

for(int i=1; i<=100; i++)


if(i % 3==0)


else(i % 5==0);




int main()


bilangan x;




  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: