Write by using do while
for(int j=8 ; j>=0 ; j- -)
System.out.print(j);
Answers
Answered by
76
Required snippet :-
int j = 8;
do
{
System.out.print(j);
j--;
}
while(j>=0)
know more:-
There are three types of looping contructs using java programming:
- for loop
- while loop
- do while loop
Syntax of for loop:
for(initialization/declaration; test condition; update)
{
//{} can be omitted if there is only one Statement
-----------------
Statements
-----------------
}
Syntax of while loop
wlile(test condition)
{
//{} can be omitted if there is only one Statement
-----------------
Statements
-----------------
//in this inside the loop only we have to update the value if required
}
Syntax of do-while loop
do
{
//{} can be omitted if there is only one Statement
-----------------
Statements
-----------------
//in this inside the loop only we have to update the value if required
}
wlile(test condition)
Similar questions