Convert the loop given below into equivalent do..while loop:
int n,res;
for(n=4,res=1;n>=1;n--)
res*=n;
System.out.println(res);
Answers
Answered by
2
Given snippet,
int n,res;
for(n=4,res=1;n>=1;n--)
res*=n;
System.out.println(res);
- To convert into Do-while
- Coding Language:Java
Answer:-
int n=4,res=1;
do
{
res*=n;
n--;
}while(n>=1);
System.out.println(res);
Similar questions