1. Create a C program that counts and categorizes characters in a given input string. The
program will count the total number of alphabets, digits, uppercase alphabets, and
vowels in the input string.
The C program provided in this assignment accomplishes the following tasks:
-Takes a single command-line argument, which is the input string to be analyzed.
-Utilizes user-defined functions for character classification and counting.
-Implements both while and for loops for character counting tasks, demonstrating a
range of loop control structures.
-Displays the following information about the input string:
-The total number of alphabets.
-The total number of digits.
-The total number of uppercase alphabets.
-The total number of vowels (both uppercase and lowercase).
The program consists of the following key components:
Function Definitions: The program defines four user-defined functions for character
counting, each corresponding to a specific task:
-countAlphabets: Counts alphabets in the input string using a while loop.
-countDigits: Counts digits in the input string using a while loop.
-countUppercase: Counts uppercase alphabets in the input string using a for loop.
-countVowels: Counts vowels (both uppercase and lowercase) using a for loop.
Main Function: The main function handles command-line argument processing invokes the
user-defined functions and displays the results.
Input Validation: The program checks if there is exactly one command-line argument
provided. If not, it displays a usage message and exits with an error code.
Character Classification: Character classification is done by manually comparing character
values to determine whether they are alphabets, digits, uppercase letters, or vowels
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 2 images
- Can you use Python programming language to to this question? Thanksarrow_forwardIn program language C: The problem is to write a program that counts the number of letters, digits, other characters, and total characters from the input. If the user does not provide any additional command-line arguments, count the occurrences from standard input. If there is an additional command-line argument, count the occurrences in the string provided on the command line. It must use two functions: one that calculates the counts from standard input, and another that calculates the counts from a string (in this case you'll want to pass argv[1] to the latter function, if argv[1] exists). In main(), check the number of command line arguments to see which function to call, call the appropriate function to get the counts, and then print out the counts in main(). Each function should require you to return multiple values. The program must use two of the following strategies, one for each of the function implementations: - Create variables in main() that will store the counts and pass…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education