Question: C only please Question 4 (10 marks). Write a program that prompts the user to enter a string and prints the goodness of the string.
C only please
Question 4 (10 marks). Write a program that prompts the user to enter a string and prints the goodness of the string. The goodness of a string in general, is calculated in the following way: If the string contains any letters except for 0 or 1, then its goodness is 0. Otherwise, its goodness is the number of 1's in the string. Call your source code file Name the c file "lastnameFirstnameA204.c". (Ritu's file would be called chaturvediRituA2Q4.c) Sample Input: Enter a string with no spaces: 0000011111 Output: Goodness of the input string is 5 Sample Input: Output: Goodness of the input string is 5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
