1. Make an algorithm to generate the following series given the number of terms to generate (n).
1, -2 / 3, 3/9, 4/27, 5/81 .............
R / /
Integer n;
Integer D = 1;
Whole DV = 1;
Whole Cont = 1;
While (Cont <= n)
{
if (D mod 2 = 0)
{
print (D * (-1) / DV)
}
but
{
print (D / DV)
}
Cont = Cont + 1;
D = cont;
DV = DV * 3
}
1, -2 / 3, 3/9, 4/27, 5/81 .............
R / /
Integer n;
Integer D = 1;
Whole DV = 1;
Whole Cont = 1;
While (Cont <= n)
{
if (D mod 2 = 0)
{
print (D * (-1) / DV)
}
but
{
print (D / DV)
}
Cont = Cont + 1;
D = cont;
DV = DV * 3
}
exercise in pseudocode