Advertisement
roronoa

triangle rectangle de 1 à n puis n-1 à 1 etc

Sep 10th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Auto-generated code below aims at helping you parse
  3.  * the standard input according to the problem statement.
  4.  **/
  5.  
  6. const n = parseInt(readline());
  7. k=0
  8. for(i=n; i>= 1; i--)
  9. {
  10.     l = '';
  11.     if(k%2==0)
  12.         for(j = 1; j <= i; j++)
  13.             l += j
  14.     else
  15.         for(j = i; j >= 1; j--)
  16.             l += j
  17.     k++
  18.     print(l)
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement