Computer Science, asked by selvarani27, 4 months ago

design a iterative algorithm to find sum of first n natural numbers.s=1+2+3....+n​

Answers

Answered by himanshu2006vps
0

Answer:

def findSum(n) :

sum = 0

x = 1

while x <=n :

sum = sum + x

x = x + 1

return sum

# Driver code

n = 5

print findSum(n)

Similar questions