How write logic for this | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How write logic for this

1 23 456 78910

17th Nov 2016, 6:39 PM
Deepak C
Deepak C - avatar
5 Answers
+ 2
this is the code in js we want to do five loops and every time we loop we increase the number of items by one . Inside the small loops we concatenate the items ,then print the the concatenated items . var x = ''; var num = 1; var m = 1; for (i = 1; i <= 5; i++) { for(;m<=i; m++){ x += num; num ++; } document.writeln(x+'<br >'); }
28th Dec 2016, 6:05 AM
Sameer Al-Salous
Sameer Al-Salous - avatar
0
Have you got some other examples ?
17th Nov 2016, 7:07 PM
Maxime
Maxime - avatar
0
Nope
17th Nov 2016, 7:09 PM
Deepak C
Deepak C - avatar
0
in c++ I can write
22nd Nov 2016, 10:40 PM
Shaiv Roy
Shaiv Roy - avatar
0
Okay write will see c+
23rd Nov 2016, 5:02 PM
Deepak C
Deepak C - avatar