C++question
C++question
4____________________________________
5____________________________________
6____________________________________
7____________________________________
8____________________________________
9____________________________________
10___________________________________
1|Page
6. W rite a C++ code guided by the following flow chart. (2 point)
1____________________________________
Write here
start 2____________________________________
3____________________________________
4____________________________________
Get n; N=1
5____________________________________
6____________________________________
N *=n ; n-- 7____________________________________
8____________________________________
n>=0 9____________________________________
10___________________________________
Output N 11___________________________________
end
7. Identify the return for relational expression, the result for the arithmetic and logic expressions where a=2,
b=1, c=3 are initialized variables. (0.5 point each)
a. a*= a - - //_______________
b. b+= c% - - a //_______________
c. (!(a>=b))? a: b //________________
8. Rewrite the source code below correcting the syntax where error is found(2 point)
Write here
1 include<iosteram> 1____________________________________
2 Using namespace std; 2____________________________________
3 int main(); 3____________________________________
4 4____________________________________
5 int n1, sum=0; 5____________________________________
6 cout<<"Enter the first number:" 6____________________________________
7 cin >> n1; 7____________________________________
8 Cout<<"Enter the second number:"; 8____________________________________
9 cin>> n2; 9____________________________________
10 sum = n1 + n2 ; 10___________________________________
11 cout << "Sum = " << sum; 11___________________________________
12 12___________________________________
13 return sum ; 13___________________________________
2 | P 14
a g e} 14
3|Page