A SIMPLE PYTHON PROGRAM THAT WILL SPLIT THREE NUMBERS INTO INDIVIDUAL.
- Nelson John
- Nov 27, 2017
- 1 min read

A python program that prompts user to enter a three digit number, the program should split up the number entered by the user into individual digits and display the sum of the individual digits
#step1 (input):prompt user to enter three digit number
number = eval(input("enter a three digit number: "))
#step2 (input):split number into three seperate digits
digit1 = number % 10
number = number // 10
digit2 = number % 10
number = number // 10
digit3 = number % 10
number = number // 10
#step3 (processing):add the three digits
sum = digit1 + digit2 + digit3
#step4 display result
print("The result is", sum)
Facebook: ayamnelrodinho1@gmail.com
Yahoo: talk2nelsonjohn2dat@yahoo.com
Whatsapp: +2349034595610
PLEASE KINDLY SHARE WITH FELLOW PROGRAMMERS AND ALSO SUBSCRIBE TO MY BLOG PAGE FOR MORE FEEDS.
Comentários