Answers for "how to find the n for which sum of natural numbers is given"

1

Determine the sum of al digits of n

def sum_of_digits(n): 
	sum = 0
	while (n != 0): 
		sum = sum + int(n % 10) 
		n = int(n/10) 
	return sum
Posted by: Guest on October-20-2020
1

sum of all n integers

Sum of n integers 1 + 2 + 3 + ... + n = n * (n + 1) / 2
Posted by: Guest on April-06-2021

Code answers related to "how to find the n for which sum of natural numbers is given"

Python Answers by Framework

Browse Popular Code Answers by Language