A

Admin • 828.03K Points
Coach

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--;
}
  • (A) 4 3 2 1
  • (B) 3 2 1
  • (C) Compiler error
  • (D) None
  • Correct Answer - Option(A)
  • Views: 7
  • Filed under category Java
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.