Search the Community
Showing results for tags 'program'.
-
Hello this is Gulshan Negi Well, I am writing a program for finding sum of natural numbers but it shows some error at the time of execution. Source Code: n = int(input("Enter the number:" )) sum=0 if n > 1: for i in range(1,n+1): sum+=i: print("The sum of all natural number upto",n,"is ",sum) else: print("Please Enter a value greater than 1") I also checked and took teference from here, but i don't know what I am missing here. Can anyone give their suggestions on this. Thanks