Question
Task 2 demonstrate two-way if else and augmented assignment operator a. Prompt the user to enter an integer that is a multiple of 7. Store
Task 2 demonstrate two-way if else and augmented assignment operator
a. Prompt the user to enter an integer that is a multiple of 7. Store the value entered.
b. Write an if-else statement that will check input to verify the number entered is a multiple of 7.
When the input is a multiple of 7, print the words Input Verified
When the input is not a multiple of seven,
determine the amount need to subtract from the number to make the input divisible by 7,
use an augmented assignment operator to subtract that number from the input to make it evenly divisible by 7,
print the words Input Corrected along with the corrected number
For example:
If the user enters 14, your program would print: Input verified.
If the user enters 17, your program would print: Input corrected to 14
If the user enters 22, your program would print: Input corrected to 21
c. Run the program several times to verify it is working
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started