Home /
Expert Answers /
Computer Science /
write-codes-using-c-using-while-loop-405582-2623676x3zqy7-jump-to-level-1-write-a-while-loop-that-pa265
(Solved): write codes using C++ using while loop 405582 2623676x3zqy7 Jump to level 1 Write a while loop that ...
write codes using C++ using while loop
405582 2623676x3zqy7 Jump to level 1 Write a while loop that reads integers from input and calculates finalNum as follows: • If the input is not divisible by 3, the program outputs "lose" and doesn't update finalNum. • If the input is divisible by 3, the program outputs "win" and increases finalNum by 1. The loop iterates until a negative integer is read. Ex: If the input is 10 6 3-1, then the output is: lose win win Final number is 2 Note: x % 3 == 0 returns true if x is divisible by 3. 1 #include 2 using namespace std; 3 4 int main() { int valueIn; int finalNum; C 4567