Question: 2. Write a C++ program that does the following: a. Prompts the user for a positive integer, validating the input until the user enters
2. Write a C++ program that does the following: a. Prompts the user for a positive integer, validating the input until the user enters a positive integer. b. Prints the count of zeroes in the integer. c. Prints the count of ones in the integer. d. Prints the count of prime digits in the integer. e. Prints the count of composite digits in the integer. f. Prints the total number of digits in the integer. Sample run of the program: Enter a positive integer input: 713402 There were 1 zeros, 1 ones, 3 prime digits, 1 composite digits, and a total of 6 digits.
Step by Step Solution
There are 3 Steps involved in it
include iostream include cmath using namespace std bool isPrimeint n if n number Validate ... View full answer
Get step-by-step solutions from verified subject matter experts
