Computer Science, asked by chakrabortyshivam44, 5 months ago

Display the output:

int a=10;

while(a>1)

{ if(a%2==0)

a - = 1;

else

a - =2;

System.out.println( a);

}​

Answers

Answered by shailkanch25
1

Answer:

9

7

5

3

1

Explanation:

a=10

while loop enters.

if block enters bcoz 10%2=0

so a becomes 9..

prints 9

a=9

while loop enters .

else block enters bcoz 9%2=1

a become 7

prints 7

a=7

while loop enters .

else block enters bcoz 7%2=1

a become 5

prints 5

a=5

while loop enters .

else block enters bcoz 5%2=1

a become 3

prints 3

a=3

while loop enters .

else block enters bcoz 3%2=1

a become 1

prints 1

a=1

while loop breaks program terminated...

Answered by vanshikaraghuvanshi
5

Answer:

mind your language... otherwise I'll mind u hole...

by the limit mey raho...

Similar questions