44.8k views
2 votes
Count Uppercase, Lowercase, special character and numeric values

Given a string, write a program to count the occurrence of Lowercase characters, Uppercase characters, Special characters and Numeric values.

Examples:

Input : #GeeKs01fOr@gEEks07
Output :
Upper case letters : 5
Lower case letters : 8
Numbers : 4
Special Characters : 2

Input : *GeEkS4GeEkS*
Output :
Upper case letters : 6
Lower case letters : 4
Numbers : 1
Special Characters : 2

User Abouasy
by
5.3k points

2 Answers

2 votes

Answer:

View Image

Explanation:

Import the #include <ctype.h> so that you can use the function to check the characters in the string.

Create variable to store letter counts and user input.

Ask for user input with scanf().

Loop through the user input and check each character. Increase count accordingly.

Print out final result.

User Dj Bazzie Wazzie
by
4.2k points
5 votes

Answer:

View Image

Step-by-step explanation:

  1. Import the #include <ctype.h> so that you can use the function to check the characters in the string.
  2. Create variable to store letter counts and user input.
  3. Ask for user input with scanf().
  4. Loop through the user input and check each character. Increase count accordingly.
  5. Print out final result.

Count Uppercase, Lowercase, special character and numeric values Given a string, write-example-1
Count Uppercase, Lowercase, special character and numeric values Given a string, write-example-2
User Chenosaurus
by
5.0k points