Question: C. Comments on how to do it would be appreciated! 1. Problem A 1.1 Specification Write a C program to count the number of digits

C. Comments on how to do it would be appreciated!

C. Comments on how to do it would be appreciated! 1. Problem

1. Problem A 1.1 Specification Write a C program to count the number of digits ('0', '1', '2', ..., '8', '9') in a line of characters. The program reads from the standard input a line of characters and outputs the number of digits found in the line. Compute the sum of all the digits found and output that sum. If the input line contains no digits, the sum is 0. 2.2 Implementation The program should: be named lab2a.c use getchar and a loop to read a line of characters. The loop terminates when a new line character' ' is entered. display the following prompt before each input line: Enter a line of characters> display on the standard output the number of digits found in the input line and the sum of all the digits, separated by a tab character 'It'. 2.3 Sample Inputs/Outputs: indigo 352 4 lab2a Enter a line of characters>Welcome to CSE2031, "Software Tools". indigo 353 lab2a Enter a line of characters>0123456789 10 45 indigo 354 & lab2a Enter a line of characters>a b c d e f g h indigo 355

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!