Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let n = Number(gets())
  2. let firstNum = 0
  3. let secondNum = 0
  4. let thirdNum = 0
  5.  
  6. for (let i = 0; i <= n; i++){
  7.     let currentNum = Number(gets())
  8.     if (currentNum >= firstNum){
  9.         thirdNum = secondNum;
  10.         secondNum = firstNum;
  11.         firstNum = currentNum;
  12.     }else if (currentNum >= secondNum){
  13.         thirdNum = secondNum;
  14.         secondNum = currentNum;
  15.     }else if (currentNum >= thirdNum){
  16.         thirdNum = currentNum;
  17.     }
  18. }
  19. print(`${firstNum}, ${secondNum} and ${thirdNum}`);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement