0

I want to print triangular numbers between 1 & 100 in php using a while loop. How can i write that?

I wrote following code. But it prints 105 also which is greater than 100. How to resolve it? https://code.sololearn.com/ws6QhMfZMtC4/?ref=app

25th Mar 2020, 1:24 PM
Geethma Wickramasinghe
Geethma Wickramasinghe - avatar
3 Respuestas
0
You can use if statement inside the loop.
25th Mar 2020, 1:51 PM
Taranjeet
Taranjeet - avatar
0
Thank you Taranjeet ..It worked...
25th Mar 2020, 4:25 PM
Geethma Wickramasinghe
Geethma Wickramasinghe - avatar
0
Welcome
25th Mar 2020, 5:08 PM
Taranjeet
Taranjeet - avatar