perhatikan pseudocode berikuta = 24b = 21c = 17if a > b: if a > c: print(a) else: print(c)else: if b > c: print(b) else: print(c)apa output yang dihasilkan program tersebut?
Question
perhatikan pseudocode berikuta = 24b = 21c = 17if a > b: if a > c: print(a) else: print(c)else: if b > c: print(b) else: print(c)apa output yang dihasilkan program tersebut?
Solution
Baik, mari kita analisis pseudocode yang diberikan langkah demi langkah:
-
Diberikan nilai awal:
a = 24 b = 21 c = 17 -
Kondisi pertama yang dicek adalah:
if a > b:Karena
a(24) lebih besar darib(21), kondisi ini benar. Maka, kita masuk ke blok kode di dalamnya. -
Di dalam blok kode tersebut, ada kondisi kedua:
if a > c:Karena
a(24) lebih besar daric(17), kondisi ini juga benar. Maka, kita masuk ke blok kode di dalamnya dan mengeksekusi:print(a) -
Karena kondisi ini terpenuhi, nilai
a(24) akan dicetak.
Jadi, output yang dihasilkan oleh program tersebut adalah:
24
Similar Questions
Diketahui terdapat sebuah pseudocode sebagai berikut:declare angka, ii = 1input(angka)while (angka != i) { if angka > 0 { i = i * 2 } input(angka)}print(i)Jika diberikan input sebagai berikut:4 0 -1 13 9 -71 6 41 32 -5 2 3 -52 1 0Berapa nilai yang akan dikeluarkan oleh program tersebut?
What will be the output of the following pseudocode?Integer pp, qq, rrset pp=5, qq= 1, rr= 4if ( pp > rr)if (qq > rr )rr = 1qq = rr + 1pp = rr + 2end if qq = pp+ 1elsepp = pp + 1end if printf pp + qq + rr
What will be the output of Pseudocode?Integer n, rev, rem, origSet n = 61206, rev = 0Set orig = nWhile n NOT EQUALS 0 rem = n MOD 10 rev = rev * 10 + rem n = n / 10End whileIf (orig IS EQUAL TO rev) Print revElse Print (orig – rev) / 6End If
What will be the output of the following Pseudocode?1.input m=9,n=62.m=m+13.n=n-14.m=m+n5.if(m>n)6. print m7.else8. print n106515
What will be the output of the following pseudocode for input a = 30, b = 60, C = 90?Integer a, b, c, sum Read a, b, c Set sum = a + b + c if ((sum EQUALS 180) and (a NOT EQUALS 0) and (b NOT EQUALS 0) and (c NOT EQUALS 0)) Print " Success" Otherwise Print "Fail" End ifQuestion 84AnswerA.Error in logic of the pseudocodeB.FailC.SuccessD.None of the mentioned
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.