Jumat, 08 Juli 2011

Program C++ Deret Geometri


At this time I will discuss what it is about geometric series in which the geometric mean by the series is the sum of several tribes in the series
geometry. Of course my friends are getting this material since schooldays. Now I will make the programs and algorithms. Check it out ...

Algoritma
Deklarasi
a,r,n           : integer            (input)
un              : integer            (output)

Deskripsi
read(n,a,r)
                   Un=a*(r*(n-1)*r)
write(un)

Berikut kode programnya :

#include <iostream.h>
#include <conio.h>
class geometri{

public:
  masukan();
  proses();
  hasil();

private:
int a,r,n,Un;
};

geometri::masukan(){
cout<<"Deret Geometri\n\n";
cout<<"Masukan Bilangan Suku ke-n: ";
cin>>n;
cout<<endl;

cout<<"Masukan Bilangan pertama : ";
cin>>a;
}
geometri::proses(){
cout<<"\n\nMasukan rasio: ";
cin>>r;

Un=a*(r*(n-1)*r);


}
geometri::hasil(){
cout<<"\n\nSuku ke-n dari deret di atas adalah : "<<Un;
cout<<"\n========================================";

}
int main(){
geometri x;
x.masukan();
x.proses();
x.hasil();
getch();
return 0;
}

explanation:
Above program is a program to know the geometric series, which users will menginputkan tribe, numbers and ratios. After that the program will run in accordance with the existing formula. In order for the tribe to which we can know the input had value. Hope can be useful

0 komentar:

Posting Komentar

Template by:

Free Blog Templates