0
How to know if it is all numbers or not all numbers in 5 characters(length)?
Sample output: Enter character:12345 Valid length All numbers Enter character:123 Invalid length Enter character:123x5 Valid length Not all numbers
4 Answers
+ 5
Test the length with strlen. Loop through the characters and test each for >= '0' and <= '9'.
+ 4
I would agree with John Wells . I think that's the simplest way to do it. You can also use the character functions like 'isdigit()'
0
Take a look at the source code..
0
Okay, thank you I will try.