Question: we wish the user to enter a single digit, we may wish to prompt multiple times in order to arrive at a valid input. Use
we wish the user to enter a single digit, we may wish to prompt
multiple times in order to arrive at a valid input. Use the prompts shown in the sample
output below to arrive at a valid digit input.
getdigit Function:
Input variables:
none
Output variables:
a scalar value representing a single digit
A possible sample case is:
digit getdigit
Enter a digit: pi
Invalid input. Enter a digit:
Invalid input. Enter a digit:
Invalid input. Enter a digit:
digit
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
