Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Latihan Soal 2</title>
- </head>
- <body>
- <script type="text/javascript">
- var a,b,c,d,e;
- a = parseInt(prompt("Masukkan bilangan a !"));
- b = parseInt(prompt("Masukkan bilangan b !"));
- c = parseInt(prompt("Masukkan bilangan c !"));
- d = parseInt(prompt("Masukkan bilangan d !"));
- e = parseInt(prompt("Masukkan bilangan e !"));
- if (a > b)
- {
- if (a > c)
- {
- if (a > d)
- {
- if (a > e)
- {
- document.write("Nilai a = ", a,", Nilai b = ", b,", Nilai c = ", c,", Nilai d = ", d,", Nilai e = ", e);
- document.write("<br\>Nilai yang terbesar adalah ",a);
- }
- }
- }
- }
- else if (b > c)
- {
- if (b > d)
- {
- if (b > e)
- {
- if (b > a)
- {
- document.write("Nilai a = ", a,", Nilai b = ", b,", Nilai c = ", c,", Nilai d = ", d,", Nilai e = ", e);
- document.write("<br\>Nilai yang terbesar adalah ",b);
- }
- }
- }
- }
- else if (c > d)
- {
- if (c > e)
- {
- if (c > a)
- {
- if (c > b)
- {
- document.write("Nilai a = ", a,", Nilai b = ", b,", Nilai c = ", c,", Nilai d = ", d,", Nilai e = ", e);
- document.write("<br\>Nilai yang terbesar adalah ",c);
- }
- }
- }
- }
- else if (d > e)
- {
- if (d > a)
- {
- if (d > b)
- {
- if (d > c)
- {
- document.write("Nilai a = ", a,", Nilai b = ", b,", Nilai c = ", c,", Nilai d = ", d,", Nilai e = ", e);
- document.write("<br\>Nilai yang terbesar adalah ",d);
- }
- }
- }
- }
- else if (e > a)
- {
- if (e > b)
- {
- if (e > c)
- {
- if (e > d)
- {
- document.write("Nilai a = ", a,", Nilai b = ", b,", Nilai c = ", c,", Nilai d = ", d,", Nilai e = ", e);
- document.write("<br\>Nilai yang terbesar adalah ",e);
- }
- }
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment