Q. Write a short program to input a digit(1 -10) and print it in words.
You can understand by Watching video :-
Answer :-
a = int (input ("Enter the digit (1-10) =")) if a ==1 : print ("one ") elif a ==2 : print ("two") elif a ==3 : print ("three") elif a == 4: print ("four ") elif a == 5: print ("five") elif a == 6: print ("six ") elif a == 7: print ("seven") elif a == 8: print ("eight ") elif a == 9: print ("nine") elif a == 10 : print ("ten") else: print ("digit is out of range ")
Output :-
Enter the digit (1-10) =6
six
>>>
Enter the digit (1-10) =3
three
>>>
Enter the digit (1-10) =8
eight
>>>
Enter the digit (1-10) =12
digit is out of range
>>>
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )