Question: C++ language Write a while loop that reads integers from input and calculates integer finalVal as foliows - If the input is not divisible by

Write a while loop that reads integers from input and calculates integer finalVal as foliows - If the input is not divisible by 5 , add the input to finalVal - Otherwise, subtract the input from finalVal. The loop iterates until a negative integer is read. Ex. If the input is 1610.52, then the output is: Final value is 1 Note x%5=0 returns true if x is divisible by 5 1 Binclude main() f int valuein: int finalval: finalVal - e; cin so valuein; Yo rour code poes here % cout \&s "Final value is " of finalVal \&s endl; return 9
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
