Question: Consider the following code segment. int num = 1 ; for ( int k = 2 ; k < 1 0 ; k + +

Consider the following code segment.
int num =1;
for (int k =2; k <10; k++)
{
num =0;
num = num + k;
}
What will be the value of num after the loop is executed?
Responses
2
2
9
9
10
10
44
44
45

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!