0

How can I code this problem by using If-else statement only?

Find Summation of the series 1*n+ 2(n-1)+.... n*1, where n will be taken from user. Use If- else condition only. I am unable to code it by if else statement. Here is the following code: https://code.sololearn.com/cA17a19A22a2/?ref=app

17th Feb 2021, 11:37 AM
Samia Haque
Samia Haque - avatar
3 Answers
+ 3
Alpha Caspian if I got what you mean then this can be calculated with mathematical formulas. In programming code often is useful recursion as here presented: https://code.sololearn.com/cGZU7IFiVPlp/?ref=app
17th Feb 2021, 9:15 PM
JaScript
JaScript - avatar
+ 1
Please clarify your question or move it to your feed. In its current form it doesn't qualify for Q&A
17th Feb 2021, 11:50 AM
Benjamin JĂŒrgens
Benjamin JĂŒrgens - avatar
+ 1
Thank you JaScript
19th Feb 2021, 8:30 AM
Samia Haque
Samia Haque - avatar