Rectify the errors in the given program:
#Python program to calculate the sum of n Natural Numbers
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;
displaying output
print("Sum of first", hold+ "natural numbers is:" sum)
Answers
Answered by
1
Answer:
The answer is given below in the screen shot. If this helps you please mark my answer brainliest.
Explanation:
Attachments:
Similar questions