Sabtu, 27 April 2013

Rumus Algoritma

Bil genap…
            Input 1-10
            Proses bil mod 2=0
            Output = 2, 4, 6, 8, 10
Uji
            2 mod 2 = 0 – true 2/2 = 1 sisa 0
            4 mod 2 = 0 – true
            Dst
Bil Ganjil…
            Input 1 – 10
            Proses bil mod 2 = 1
            Output = 1, 3, 5, 7, 9
Uji
            1 mod 2 = 1 – true      ½ = 0 sisa 1
            3 mod 2 = 1 – true      3/2 = 1 mod 1