Do they mean the Hex number for the ASCII character 0-9?

  • Thread starter Thread starter vladittude0583
  • Start date Start date
  • Tags Tags
    Mean
Click For Summary
SUMMARY

The discussion centers on writing code to count decimal digits (0-9) input from the keyboard until the user presses '\n'. Participants clarify that the question pertains to ASCII characters for digits 0-9, not their hexadecimal representations. The consensus is that users should input a string, and a function should be implemented to evaluate each character to determine if it falls within the range of 0-9.

PREREQUISITES
  • Understanding of ASCII character encoding
  • Proficiency in string manipulation in programming
  • Knowledge of control structures for input handling
  • Familiarity with function creation in programming languages
NEXT STEPS
  • Implement a function to count characters in a string
  • Research string methods in Python or JavaScript for character evaluation
  • Explore ASCII values and their corresponding characters
  • Learn about input handling techniques in your preferred programming language
USEFUL FOR

Beginner programmers, educators teaching string manipulation, and anyone interested in understanding ASCII character handling in coding.

vladittude0583
Messages
40
Reaction score
0
Hey guys, I need a little bit of help understanding this question and writing the code for it:

Write the code to count the number of decimal digits (0-9) input from the keyboard until the user presses '\n' and then display this count on the monitor (Declare necessary variables)

Regarding the decimal digits, do they mean the Hex number for the ASCII character 0-9? Could you please clarify this for me? Thanks.
 
Physics news on Phys.org
i'm pretty sure they mean the ascii code for characters 0-9. (without looking)i believe all the ascii characters with values 0 through 9 are non-printing and can't be entered from the keyboard without a combination of keypresses (alt codes). whether you look at them as hex is up to you.
 
You need to take in the input as a string, examine each string character individually and write a function to determine if the character examined is 0-9. You know what to do from here, right?
 

Similar threads

Replies
11
Views
6K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 10 ·
Replies
10
Views
2K
Replies
3
Views
2K
  • · Replies 8 ·
Replies
8
Views
7K
  • · Replies 7 ·
Replies
7
Views
3K
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
1
Views
3K