+ 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
1 Answer
+ 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