Declare a Boolean variable named allEven. Read in an input valuefor variable valCount. Then, read valCount integers from input andoutput "All match" if all integers are even. Otherwise, output "Notall match".
Note: Even numbers are divisible by 2.
Ex: If the input is 3 70 80 40, the output is:
All match
#include <iostream>using namespace std;
int main() { int valCount;
/* Additional variable declarations go here */
/* Your code goes here */
if (allEven) { cout << "All match" << endl; } else { cout << "Not all match" <<endl; }
return 0;}
Declare a Boolean variable named allEven. Read in an input value for variable valCount. Then, read valCount integers fro
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am