Computer Science
Write a short program to input a digit and print it in words.
Python
Python Control Flow
57 Likes
Answer
d = int(input("Enter a digit(0-9): "))
if d == 0 :
print("Zero")
elif d == 1 :
print("One")
elif d == 2 :
print("Two")
elif d == 3 :
print("Three")
elif d == 4 :
print("Four")
elif d == 5 :
print("Five")
elif d == 6 :
print("Six")
elif d == 7 :
print("Seven")
elif d == 8 :
print("Eight")
elif d == 9 :
print("Nine")
else :
print("Invalid Digit")
Output
Enter a digit(0-9): 6
Six
Answered By
23 Likes
Related Questions
Write a program to input length of three sides of a triangle. Then check if these sides will form a triangle or not.
(Rule is: a+b>c;b+c>a;c+a>b)Write a short program to check whether square root of a number is prime or not.
Write a short program to print first n odd numbers in descending order.
A year is a leap year if it is divisible by 4, except that years divisible by 100 are not leap years unless they are also divisible by 400. Write a program that asks the user for a year and prints out whether it is a leap year or not.