Computer Science, asked by Niyardas644, 1 year ago

Write a python script to calculate the sum of first 10 natural numbers.

Answers

Answered by Aishwarya98
53

The input number is 10


num = int(input("Enter the value of n: "))

hold = num

sum = 0

if num <= 0:  

  print("Enter a whole positive number!")  

else:  

  while num > 0:

       sum = sum + num

       num = num - 1;

   print("Sum of first", hold, "natural numbers is: ", sum)


So the output will be 55 (1+2+3+4+5+6+7+8+9+10)


Aishwarya98: mark me as brainliest..
Similar questions