1) Buat algoritma program untuk menghitung log (1/x1) + log (1/x2) + log (1/x3) + ... + log (1/xn) !!!

_____________________________________________________________________________________

Program deret_log

{Diberikan x dan n, kemudian dihitung log (1/x1) + log (1/x2) + log (1/x3) + ... + log (1/xn)}

_____________________________________________________________________________________

Kamus

x, n, i :integer

sum, lg: real

_____________________________________________________________________________________

Algoritma

Input(x, n)

Sum ⃪ 0 {inisialisasi}

i 1 {First_Elmt}
while (i<= n) do {EOP}

begin

lg log(1/(x^i)) {Current_Elmt}

sum ⃪ sum + lg

i ⃪ i+1 {Next_Elmt}

end

output(sum)

_____________________________________________________________________________________

2) Buat algoritma program untuk menghitung deret 22+42+62+82+...+n2 !!!!

_____________________________________________________________________________________

Program jumlah_kuadrat_bilgenap

{Diberikan n, dihitung deret 22+42+62+82+...+n2}

_____________________________________________________________________________________

Kamus

I, n, kua, sum: integer

_____________________________________________________________________________________

Algoritma

Output(‘Masukkan bilangan genap’)

Input(n)

If (n mod 2 = 0) then

Begin

Sum ⃪ 0 {inisialisasi}

i 2 {First_Elmt}

while (i<= n) do {EOP}

begin

kua i*i {Current_Elmt}

sum ⃪ sum + kua

i ⃪ i+2 {Next_Elmt}

end

output(sum)

end

else

output(‘Bilangan yang anda masukkan bukan bilangan genap’)

__________________________________________________________________________________________________________________

0 Comments:

Post a Comment