A sequence U1, U2, U3, .... called geometric sequence if the sequence comparison of the two tribes are fixed. Value of the fixed ratio is called the ratio. a + ar ² + ....... + Arn-1 is called a geometric series with a composition as follows:
a = initial rate
r = ratio
n = many tribes
Formula to find the nth are as follows:
Formula to find the number of n terms is as follows:
• Algorithm Print Geometric Series
Print geometric algorithms
Declaration:
a, b, n, i: Integer
x []: Array of Integer
Description:
read (a, b, n)
x [1] <= 1
x [2] <= a * b
x [3] <= a * b * b
for i = 4 to n do
x [i] <= x [2] * [xi-1]
end for
for i = 1 to n do
write (x [i])
end for
• Counting algorithm of the n
The algorithm to calculate nth
Declaration:
a, b, n, un, i, r: integer
Description:
read (a, b, n)
r <= 1for i = 1 to (n-1) do
r <= r * b
end for
un <= a * r
write un
• Algorithm Counting all the tribes
Algorithms add up all the Tribes
Declaration:
read (n)
number, i, n: Integer
x [ ] : Array of Integer
Description:
number <= 0
for i = 1 to n do
sum <= sum + x [i]
end for
write (number)
Geometric Series Program
a = initial rate
r = ratio
n = many tribes
Formula to find the nth are as follows:
Formula to find the number of n terms is as follows:
• Algorithm Print Geometric Series
Print geometric algorithms
Declaration:
a, b, n, i: Integer
x []: Array of Integer
Description:
read (a, b, n)
x [1] <= 1
x [2] <= a * b
x [3] <= a * b * b
for i = 4 to n do
x [i] <= x [2] * [xi-1]
end for
for i = 1 to n do
write (x [i])
end for
• Counting algorithm of the n
The algorithm to calculate nth
Declaration:
a, b, n, un, i, r: integer
Description:
read (a, b, n)
r <= 1for i = 1 to (n-1) do
r <= r * b
end for
un <= a * r
write un
• Algorithm Counting all the tribes
Algorithms add up all the Tribes
Declaration:
read (n)
number, i, n: Integer
x [ ] : Array of Integer
Description:
number <= 0
for i = 1 to n do
sum <= sum + x [i]
end for
write (number)
Geometric Series Program
# Include <cstdlib>
# Include <iostream>
using namespace std;
geometry class {
friend istream & operator>> (istream &, & geometry);
friend ostream & operator <<(ostream &, & geometry);
public:
geometry ();
void print ();
private:
int x [100];
int a, b, n, un, sn;
int count;
};
istream & operator>> (istream & mlebu, geometry & s) {
court <<"Enter Interest First:"; mlebu>> S.A;
court <<"Enter r:"; mlebu>> s.b; court <<endl;
court <<"Enter the Number of Interest:"; mlebu>> sn; court <<endl;
mlebu return;
}
ostream & operator <<(ostream & metu, geometry & v) {
metu <<"Interest First:" <<v.a <<endl;
metu <<"r:" <<v.b <<endl;
metu <<"Number of Interest:" <<v.n <<endl;
metu <<"Geometric Series:";
for (int i = 0; i <v.n; i + +) {
metu <<v.x [i ]<<",";}
metu <<endl;
metu <<"Total All Runs:" <<v.jumlah <<endl;
return metu;
court <<endl;}
geometry: geometry () {
court <<"\ t \ tSlamet Icelandic Al Hidayah" <<endl;
court <<"\ t \ t 10018075" <<endl;
court <<endl;
court <<"PROGRAM RUNS PRINTING AND COUNTING GEOMETRY" <<endl;
court <<endl;
}
void geometry:: print () {
x [0] = a;
x [1] = a * b;
x [2] = a * b * b;
for (int i = 2; i <n; i + +) {
x [i] = x [1] * x [i-1];}
number = 0;
for (int i = 0; i <n; i + +) {
sum = sum + x [i];}
}
int main (int argc, char * argv [])
{
geometry x;
cin>> x;
x.cetak ();
court <<x;
court <<endl;
system ("PAUSE");
return EXIT_SUCCESS;
}
Output :
Well that's the program that I can make,,,,,!
If there are less jelass know any mistake, do not hesitate to leave a comment ataun advice. So that I can fix it later terimakasihh over his visit,,
Regards super ..
0 Response to " GEOMETRIC SERIES PROGRAM C + + "
Post a Comment