0

Triangle Pattern. HELP !!!

https://code.sololearn.com/cP24hY4c5Xiw/?ref=app This program works fine but i have a little confusion about a step i have declared s= (n/2)+1; so when i use this "s" as a condition in "i" loop. I dont get the required output. but when i use this value of s in condition it works fine... it should work for both the cases as "s" and ( n/2)+1 are equal please help.. thank you

2nd Jul 2017, 6:23 PM
Subhankar Golder
Subhankar Golder - avatar
3 odpowiedzi
+ 2
your welcome :)
5th Jul 2017, 2:06 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
It is because you modify the value of s in the for loop. It is the line "--s;" that have this effect.
2nd Jul 2017, 8:05 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
Thank You 😇
5th Jul 2017, 2:05 PM
Subhankar Golder
Subhankar Golder - avatar