Professional Documents
Culture Documents
1.1
Int var1 = 4;
Int newVal = 0;
=10-4*2;
newVal=2;
1.2
a =5;
Case1: a=5+3=8;
Case3: a=8*3=24;
Case5: a=++a+10;
= ++5+10;
=6+10=16;
Case6: a /= 2=16/2=8;
Default: a=a+1=8+1=9;
a= 9;
1.3
Int count = 0;
value += count;
count++
return value;
FindValue=26;
Question 2
Int a,b,c;
2.1
The code's purpose is to display and find unknown values of S using values from variable
N, which start from 0 to 5.
2.2
Question 3
Line3:
a valueP
2 6
2 6 0
Line7: a valueP count
3 6 0
3 6 2
Returna;
6 6 2
6 6 4
Returna;
13 6 4
13 6 6
Since count is no longer less than ValueP we exit the execution of the loop.
Question4
#include <iostream>
Int main( )
Int NoOfRegnt;
float feePPerson, amntComOwesSem;
Cout << “Input the number of registants(if the user enter a number that is less or
“equal to zero an error message should be displayed):” << endl;
noOf