Q. What is the output of the below Java program with a decrement operator and WHILE-loop?
Code:int a=4;
while(a>0)
{
System.out.print(a + " ");
a--;
}
β
Correct Answer: (A)
4 3 2 1
int a=4;
while(a>0)
{
System.out.print(a + " ");
a--;
}
You must be Logged in to update hint/solution