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
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
5
Answer:
mind your language... otherwise I'll mind u hole...
by the limit mey raho...
Similar questions
Science,
3 months ago
Computer Science,
3 months ago
Math,
3 months ago
Psychology,
7 months ago
Chemistry,
11 months ago