Advertisement
WiktoriaRatajczyk

JavaScript1-9

Nov 23rd, 2020
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const n1 = prompt ("Podaj pierwszą liczbę"); //a
  2. const n2 = prompt ("Podaj drugą liczbę"); //b
  3. const n3 = prompt ("Podaj trzecią liczbę"); //c
  4.  
  5. if (n1 < n2 && n1 < n3) //a
  6. {
  7.     document.write (n1 + "   ");
  8.    
  9.     if (n1 < n2 && n2 < n3) //a b c
  10.     {
  11.         document.write (n2 + "   " + n3);
  12.     }
  13.    
  14.     else if (n1 < n2 && n2 > n3) // a c b
  15.     {
  16.     document.write (n3 + "   " + n2);
  17.     }
  18. }
  19.  
  20. else if (n2 < n1 && n2 < n3) //b
  21. {
  22.     document.write (n2 + "   ");
  23.    
  24.     if (n2 < n1 && n1 < n3) //b a c
  25.     {
  26.         document.write (n1 + "   " + n3);
  27.     }
  28.    
  29.     else if (n2 < n3 && n3 < n1) //b c a
  30.     {
  31.     document.write (n3 + "   " + n1);
  32.     }
  33. }
  34.  
  35. else if (n3 < n1 && n3 < n2) //c
  36. {
  37.     document.write (n3 + "   ");
  38.    
  39.     if (n3 < n1 && n1 < n2) //c a b
  40.     {
  41.         document.write (n1 + "   " + n2);
  42.     }
  43.    
  44.     else if (n3 < n1 && n2 < n1) //c b a
  45.     {
  46.     document.write (n2 + "   " + n1);
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement