ilham_hax0r

Latihan 2 Panjang (Javascript - Kondisi)

Dec 5th, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.89 KB | None | 0 0
  1. <html>
  2.     <head>
  3.         <title>Latihan Soal 2</title>
  4.     </head>
  5.     <body>
  6.         <script type="text/javascript">
  7.             var a,b,c,d,e;
  8.             a = parseInt(prompt("Masukkan bilangan a !"));
  9.             b = parseInt(prompt("Masukkan bilangan b !"));
  10.             c = parseInt(prompt("Masukkan bilangan c !"));
  11.             d = parseInt(prompt("Masukkan bilangan d !"));
  12.             e = parseInt(prompt("Masukkan bilangan e !"));
  13.            
  14.             if (a > b)
  15.             {
  16.                 if (a > c)
  17.                 {
  18.                     if (a > d)
  19.                     {
  20.                         if (a > e)
  21.                         {
  22.                             document.write("Nilai a = ", a,", Nilai b = ", b,", Nilai c = ", c,", Nilai d = ", d,", Nilai e = ", e);
  23.                             document.write("<br\>Nilai yang terbesar adalah ",a);
  24.                         }
  25.                     }
  26.                 }
  27.             }
  28.             else if (b > c)
  29.             {
  30.                 if (b > d)
  31.                 {
  32.                     if (b > e)
  33.                     {
  34.                         if (b > a)
  35.                         {
  36.                             document.write("Nilai a = ", a,", Nilai b = ", b,", Nilai c = ", c,", Nilai d = ", d,", Nilai e = ", e);
  37.                             document.write("<br\>Nilai yang terbesar adalah ",b);
  38.                         }
  39.                     }
  40.                 }
  41.             }
  42.             else if (c > d)
  43.             {
  44.                 if (c > e)
  45.                 {
  46.                     if (c > a)
  47.                     {
  48.                         if (c > b)
  49.                         {
  50.                             document.write("Nilai a = ", a,", Nilai b = ", b,", Nilai c = ", c,", Nilai d = ", d,", Nilai e = ", e);
  51.                             document.write("<br\>Nilai yang terbesar adalah ",c);
  52.                         }
  53.                     }
  54.                 }
  55.             }
  56.             else if (d > e)
  57.             {
  58.                 if (d > a)
  59.                 {
  60.                     if (d > b)
  61.                     {
  62.                         if (d > c)
  63.                         {
  64.                             document.write("Nilai a = ", a,", Nilai b = ", b,", Nilai c = ", c,", Nilai d = ", d,", Nilai e = ", e);
  65.                             document.write("<br\>Nilai yang terbesar adalah ",d);
  66.                         }
  67.                     }
  68.                 }
  69.             }
  70.             else if (e > a)
  71.             {
  72.                 if (e > b)
  73.                 {
  74.                     if (e > c)
  75.                     {
  76.                         if (e > d)
  77.                         {
  78.                             document.write("Nilai a = ", a,", Nilai b = ", b,", Nilai c = ", c,", Nilai d = ", d,", Nilai e = ", e);
  79.                             document.write("<br\>Nilai yang terbesar adalah ",e);
  80.                         }
  81.                     }
  82.                 }
  83.             }
  84.         </script>
  85.     </body>
  86. </html>
Advertisement
Add Comment
Please, Sign In to add comment