Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

How many times while loop condition is tested in the following C code snippets, if i is initialized to 0 in both the cases?
while (i < n)
i++;
————-
do
i++;
while (i <= n);

How many times while loop condition is tested in the following C code snippets, if i is initialized to 0 in both the cases?
while (i < n)
i++;
————-
do
i++;
while (i <= n);
a) n, n
b) n, n+1
c) n+1, n
d) n+1, n+1

Answer: d

Join The Discussion