How to print a number in word in c.ending digit with zero. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to print a number in word in c.ending digit with zero.

123 one two three 120 one two zero

23rd Dec 2019, 10:07 PM
SAI KUMAR SATAPATHY
SAI KUMAR SATAPATHY - avatar
3 Answers
+ 1
You can create an String array for number from zero to nine then make a characters array from your number for ex(in java by using toCharArray() function), then for every element in this char array you can print revelent string in the strings array essay pessy
23rd Dec 2019, 10:11 PM
Abdol Hashimi
Abdol Hashimi - avatar
0
In c...convert the number to a c-string/character array.: http://www.cplusplus.com/reference/cstdio/sprintf/ Use a switch inside a for loop. (I initialy used "itoa" for the convertion but "This function is not defined in ANSI-C")...see link.
24th Dec 2019, 12:50 AM
rodwynnejones
rodwynnejones - avatar
0
int n = 123; printf("%d", n/10*10);
24th Dec 2019, 1:20 AM
HonFu
HonFu - avatar