program to find sum till n natural numbers in python
#sum of natural number till n.
n=int(input('no. :'))
gross=0
no=0
while no < n:
no+=1
gross+=no
print('no.', no ,'sum of n', gross)
print('no.',n,'total',gross)
program to find sum till n natural numbers in python
#sum of natural number till n.
n=int(input('no. :'))
gross=0
no=0
while no < n:
no+=1
gross+=no
print('no.', no ,'sum of n', gross)
print('no.',n,'total',gross)
python program to find sum of digits of a number using while loop
# Write a Program to display sum of all digits of a given
# Number N by user
n = int(input('Enter a number : '))
sum=0
while(n>0):
rem = n%10
sum = sum+rem
n = n//10
print('reversed no. is : ',int(sum))
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us