+ 4
what is missing from the codes that I entered? , how to add the numbers I entered?
how to display the output, for example N = 5, the output displays: 1 + 2 + 3 + 4 + 5 = 15 https://code.sololearn.com/ccTqskq7x2qN/?ref=app
3 Answers
+ 3
What I would do in a code like that is set an if statement in the for loop to check whether the variable k is equal to the last value in the loop (which, I guess in this case would be n), and set it to output k + " = ", with an else statement outputting what you already have to output (this would get the "x1 + x2 + x3... + xN = " output). For the answer, you could set a recursive function to add up the values, similar to what you would do with a factorial (but rather than multiplying you just add)
+ 3
Okay,I understand what you mean, Thank you for the explanation.
+ 2
I do not really understand your point.