Computer Science, asked by studystar80, 1 year ago

please please answer this question what will be the output and please give the dryrun

Attachments:

Answers

Answered by nain31
2
 \boxed{CONTINUE \: STATEMENT }

Continue statement skips the rest of the statement for the value and resume next iteration.

 \boxed{CODING}

Class Usingcontinue

{

public void test()

{

for(int j=0;j<10 ;j++)

{

System. out. print(j + " ");

if(j%2 = = 0)

continue;

System. out. print( " ");

}

}

}

It prints all odd numbers betwen 1 and 10.The conditions checks that if the number is divisible by 2 continue statement skips it and move to next value.

 \boxed{DRY \: RUN}

◼j=0

For first, it will print then will check.

Condition ▶0 %2 = 0

As % gets the remaibded value,

Hence the condition is true , continue statement skips it and move to next value.

◼j=1


Condition ▶1 %2 = 1

Hence the condition is false , continue will get skiped and the number will get printed and will move to next value.

◼j=2

For first, it will print then will check.

Condition ▶2 %2 = 0

Hence the condition is true , continue statement skips it and move to next value.

◼j=3


For first, it will print then will check.
Condition ▶3 %2 = 1

Hence the condition is false , continue will get skiped and the number will get printed and will move to next value.

◼j=4

For first, it will print then will check.

Condition ▶4%2 = 0

Hence the condition is true , continue statement skips it and move to next value.

◼j=5

Condition ▶5%2 = 1

Hence the condition is false , continue will get skiped and the number will get printed and will move to next value.

◼j=6

For first, it will print then will check.

Condition ▶6%2 = 0

Hence the condition is true , continue statement skips it and move to next value.

◼j=7


Condition ▶7%2 = 1

Hence the condition is false , continue will get skiped and the number will get printed and will move to next value.

◼j=8

For first, it will print then will check. m

Condition ▶8%2 = 0

Hence the condition is true , continue statement skips it and move to next value.

◼j=9

Condition ▶9%2 = 1

At the last condition is also false , continue will get skiped and the number will get printed and will move to next value.

 \boxed{O U T P UT}



0 1

2 3

4 5

6 7

8 9
Similar questions