Write a program to accept characters from the user and count total alphabet and digit till the user enters ‘$’. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

Write a program to accept characters from the user and count total alphabet and digit till the user enters ‘$’.

9th Oct 2022, 9:26 AM
Sam Mtle
Sam Mtle - avatar
2 Answers
+ 2
1. Prepare a variable for counting alphabets and numeric characters. Let's just name it <alphanum_counter> 2. Use getchar() to read characters in a loop, any loop you are convenient with will do. 3. Check whether the given character was a '
#x27;. If so, break out of the loop. 4. When the read character passed step 3, use isalnum() from <ctype.h> header to verify whether the given input was alphabetic or numeric. If it is, increment value of <alphanum_counter>.
9th Oct 2022, 10:12 AM
Ipang
+ 1
Sam Mtle This section is intended for programming related questions, not to assign tasks to other users. If you have a question on this assignment, pls edit the question description.
10th Oct 2022, 12:23 AM
Emerson Prado
Emerson Prado - avatar