Forum Kuliah UAD
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Tugas Individu Pemrog Arif Rohman S.(11006102)

Go down

Tugas Individu Pemrog Arif Rohman S.(11006102) Empty Tugas Individu Pemrog Arif Rohman S.(11006102)

Post  Arif Rohman S. Sat Jun 29, 2013 6:23 pm

TUGAS INDIVIDU PEMROGRAMAN KOMPUTER
Arif Rohman Soleh ( 11006102 ) / kls C

Diketahui :
X := 2 dan Y := 5 {variabel ini bersifat global karena penulisannya di atas ‘pemanggil’ procedure coba1 dan coba2}
Coba1 (3) , nilai a adalah 3.
x := a + 5
x := 3 + 5
x := 8 {Lokal}

y := x * 2 {substitusikan nilai x = 8, ke persamaan ini }
y := 8 * 2
y := 16 {Global}

Coba2 (-3) , nilai b adalah -3.
x := b * 2
x := -3 * 2
x := -6 {Global }

y := x + y
y := -6 + 16 { x : = -6(Global) , y := 16 (Global)}
y := 10 {Lokal}

Coba1 (y) = Coba1 (10). Maka y = a. Nilai a sekarang adalah 10. Substitusikan pada program procedure coba1.
x := a + 5
x := 10 + 5
x := 15 {Lokal }
y := x * 2
y := 15 * 2 { x := 15 (lokal) }
y := 30 {Global}

maka, nilai dari x dan y yang menjadi keluaran akhir adalah
x:=-6 (karena global)
y:=30 (nilai y yang dipakai disini adalah 30, karena hitungan terakhir dari nilai y yang bernilai global adalah 30)



Arif Rohman S.

Jumlah posting : 1
Join date : 29.06.13

Kembali Ke Atas Go down

Kembali Ke Atas

- Similar topics

 
Permissions in this forum:
Anda tidak dapat menjawab topik