Question: #include #include using namespace std; int get(void); int main() { int a, sum, i; sum = 0; for( i = 0; i < 4 ;
#include
#include
using namespace std;
int get(void);
int main()
{
int a, sum, i;
sum = 0;
for( i = 0; i < 4 ; i++)
{
a = get();
sum = sum + a;
}
cout << sum << endl; // What is the output
}
int get(void)
{
int answer;
cin >> answer;
while( answer % 2 == 0 )
{
cin >> answer;
}
return answer;
}
I need a detailed explanation of the code above and also about the int get(void) function and also about the modulo function. Also, how does the program calculate the following data types:
4 , 2 , 3 ,5 ,8 ,6 ,10, 1 ,12, 7, 9, 14
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
