1.

(i) Write the value of C after executing the following code:int P;int R = 8;int oddNum;int C = 0;for(P = 1; P < R; P = P+3){       oddNum = P %2;        if(oddNum = = 1)         {                   C = C + 1;                 }}(ii) What the value that will be stored in the variable t after the execution of the following code. How many times will the loop execute?int sum = 0;int score = 0;double t;   do             {                         score = score + 1;                          sum = sum + score;                  }                         while (score < =3);       t = sum/3;

Answer»

(i) C = 2

(ii) t = 3.33333333333



Discussion

No Comment Found

Related InterviewSolutions