+ 2
How to display a number and all that is less than that number then sum them.
So I’m working on a code to figure out how to have a user input a number like 5 and have it display 12345 then add them up to equal the sum so in this case It be 15. I’ve tried lots of things and the result is always either just the single number that was input or the range of numbers. I have to use a for loop but I always get a warning that “i” is used initialized I’m the function “for( a=bla; 1 < i; i++) help overall would be very greatly appreciated
2 Réponses
+ 3
So you don't need to use loops here. Already exists a expression to calculate this.
Here check my code:
https://code.sololearn.com/cE4FK4CxiOQj
In this case use looping is bad for efficiency time