Question
Integer numElements is read from input. Then numElements integers are read and stored in vector numbersList. Write a loop that outputs each element in numbersList
Integer numElements is read from input. Then numElements integers are read and stored in vector numbersList. Write a loop that outputs each element in numbersList that is divisible by 9, and adds 1 to each divisible by 9 element. End each output with " is corrected to a number not divisible by 9" followed by a newline.
Ex: If the input is 3 36 54 23, then the output is:
Original numbers: 36 54 23
36 is corrected to a number not divisible by 9
54 is corrected to a number not divisible by 9
Nearest numbers not divisible by 9: 37 55 23
-----------------------------------------------------------------------------------------------------------
#include
int main() { int numElements; unsigned int i; vector \\ Enter Your Code Here in C++ (Thank you!) cout Integer numElements is read from input. Then numElements integers are read and stored in vector numbersList. Write a loop tha outputs each element in numbersList that is divisible by 9 , and adds 1 to each divisible by 9 element. End each output with " is corrected to a number not divisible by 9" followed by a newline. Ex: If the input is 3365423 , then the output is: Original numbers: 365423 36 is corrected to a number not divisible by 9 54 is corrected to a number not divisible by 9 Nearest numbers not divisible by 9: 375523
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