algo 6

I = Input (scanf, getchar,…)

P = Process (Selection [ If-else, Switch case, Nested If], Looping/Repetition [for, while, do-while], storage [file, sql, nosql ] )

O = Output (printf,…)

Contoh soal: vibonaci (1 1 2 3 5 …)

Int a = 1, b = 0, c;

For{

C = a + b;

A= b;

B=c;

Printf(“%d ”,c);

}

Contoh soal: bilangan prima (2,3,5,7,11,…)

Int angka

If (angka%2 == 0 || angka % angka == 0); i++;

If (i >= 2) printf(“Bukan prima”);

Atau

Sieve (1000)                       —> mencetak semua angka 1 – 1000

Lalu hilangkan angka yang dapat dibagi dengan 2,3,4,…

Leave a Reply

Your email address will not be published. Required fields are marked *