At Westonci.ca, we connect you with the answers you need, thanks to our active and informed community. Our Q&A platform offers a seamless experience for finding reliable answers from experts in various disciplines. Discover in-depth answers to your questions from a wide network of professionals on our user-friendly Q&A platform.
Sagot :
omg a computer program
i love it
okay so i will assume taht you want the program to be in python
here we go
a = int(input("Enter a number ")
b = int(input("Enter another number ")
sum = a + b
def Digits(sum):
count = 0
while sum != 0:
sum //= 0
count += 1
return count
print(f"Sum is {sum} \nnumber of digits are {Digits(sum)}")
Answer:
#Sum of Digits
a = int(input("Enter a number: "))
sumofdigits = sum(int(dig) for dig in str(number))
print("Sum of digits: ", sumofdigits)
# Number of digits
count = 0
print ("Total number of digits : ",len(str(abs(a))))
Explanation:
It is pretty self-explanatory however, I will tell it to you anyways. So, the sum of digits iterates to each digit and adds them up. For the number of digits, it uses in-built functions (length, string and absolute)
Thanks for stopping by. We are committed to providing the best answers for all your questions. See you again soon. We hope this was helpful. Please come back whenever you need more information or answers to your queries. Westonci.ca is your go-to source for reliable answers. Return soon for more expert insights.