Deklarasi :
n,jumlah,x : integer
rata : real

Deskripsi :
jumlah=0
i=1
repeat
julmah=jumlah+(1/i)
i=1+1
selisih=(1/i)-(1/(i-1))
until about(selisih)<0,001
write(jumlah,i)

==> Flowchart :
Image

==> Programnya :

#include <iostream.h>
#include <conio.h>
#include <math.h>
class Deret{
 friend ostream& operator<<(ostream&, Deret&);
public :
 float hitung_Deret();
private:
 int n;
 float hasil;
 };
float Deret::hitung_Deret(){
 float selisih,jumlah=0.0;
 int i=1;
 do{
 jumlah+=1.0/(i-1)-1.0/i;
 }while(selisih>=0.001);
 cout<<"Perulangan dilakukan sebanyak :"<<i<<endl;
 return jumlah;
 }
ostream& operator<<(ostream& out, Deret&){
 out<<"Jumlah deret ="<<A.hitung_Deret();
 return out;
 }
void main(){
 Deret X;
 cout<<X;
 }
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