What is the final value of the string output given the following code fragment? int counter = 0; int num = 0; string output = ""; while (counter < 3) { num = num * 1; counter = counter + 1; } output = Convert.ToString(num);

Respuesta :

int counter = 0;

int num = 0;

string output = "";

while (counter < 3) {

num = num * 1;

counter = counter + 1; }

output = Convert.ToString(num);

Output:

Counter = 0

num = 0 * 1 - - > num = 0

Counter = 1

num = 0 * 1 - - > num = 0

Counter = 2

num = 0 * 1 - - > num = 0

Counter = 3 (break)

num = 0

output = "0"

ACCESS MORE