Computer Science, asked by praneeth7766, 9 months ago

Have the function Math Challenge (num) add up all the
numbers from 1 to num. For example: if the input is 4
then your program should return 10 because 1 + 2 + 3 + 4
= 10. For the test cases, the parameter num will be any
number from 1 to 1000
Examples​

Answers

Answered by RuwaisnZaid
21

Explanation:

def num(n):

for i in range(1,n+1):

sum +=I

return sum

x = int(input ("Enter a no"))

total = num(n)

print("Total sum",total)

mark me as brainly

Similar questions