Deklarasi : a,b = integer

Deskripsi :

a –> 1

b –> 100

a%5==0 && a%7==0

a –> a+1

Secara Iteratif :

==> Flowchart :                                                         ==> hasil Outputnya :                         

              

Secara Rekursif :

==> Flowchart : 

              

==> Hasil Outputnya : 

==> Program :  


#include <iostream>

#include <string>

using namespace std;

&nbsp;

class Bilangan{

private:

int x,y;

public:

Bilangan(){x=1;y=100;}

int rekursif(int x,int y);

void rekursif();

};

&nbsp;

int Bilangan::rekursif(int x,int y){

&nbsp;

if (x<=100){

if (x%5==0 && x%7==0){

cout<<"hasil :"<<x<<endl;

}

return rekursif(x+1,y);

}

}

int main()

&nbsp;

{   Bilangan z;

z.rekursif(1,100);

&nbsp;

system("PAUSE");

return EXIT_SUCCESS;

}

About niehennys

just another girl.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s