WAP in Java to find the factorial of a number using while loop.
Answers
Answered by
1
Answer:
hope it helps you guys
Explanation:
don't forget to follow me
Attachments:
Answered by
3
Answer:
Explanation:
public class JavaExample {
public static void main(String[] args) {
//We will find the factorial of this number
int number = 5;
long fact = 1;
int i = 1;
while(i<=number)
{
fact = fact * i;
i++;
}
System.out.println("Factorial of "+number+" is: "+fact);
}
}
Similar questions