0

Print this - I am stuck at this problem.. help I want a logical program for this.

if we take n=3 then output:123 654 789 similarly- n=5 then output: 12345 109876 1112131415

8th Aug 2019, 2:18 PM
Nikhil
Nikhil - avatar
5 Antworten
9th Aug 2019, 3:24 AM
Bilbo Baggins
Bilbo Baggins - avatar
+ 5
https://code.sololearn.com/crhQTOdJ7jv8/?ref=app.. Check this
8th Aug 2019, 2:55 PM
Sujithra
0
Bilbo Baggins awesome dude thanks for your answer.. its really appreciable
9th Aug 2019, 1:52 PM
Nikhil
Nikhil - avatar
0
😎 "Awesome" Lover ❤️ nice try dude.. but you forgot 789 at the last.. btw thanks
9th Aug 2019, 1:53 PM
Nikhil
Nikhil - avatar
0
Change the patternVal to any number it will return the pattern dynamically const PrintPattern = () => { let k='',m=1; for(let i = 1;i<=PatternVal;i++){ let l=i%2 == 0 ? i*PatternVal : i*PatternVal; m=i%2!==0&&i>1?(i-1)*PatternVal+1:m; for(let j = 1;j<=PatternVal;j++){ if(i%2!==0){ k=k+m+' '; m++; }else{ k=k+l+' '; l--; } } k = k + '\n'; } return k; }
28th Dec 2022, 8:54 AM
surya neelankar
surya neelankar - avatar