write a program to input an integer and display the sum of digit, products of digit and average of digit in java
Answers
Answered by
1
Answer:
n = int(input("Enter a number: ")) # user input
digitSum = 0 # store the digit sum
while(n > 0):
# loop will terminate when n = 0
rem = n % 10 # last digit
digitSum += rem # adding the digits
n = n // 10 # remaining value
print(digitSum) # prints final result
Explanation:
please mark me a brainlist
Similar questions