Math, asked by Giri4422, 1 year ago

Write a java program to calculate the factorial of an integer using while loop

Answers

Answered by Swebo
3
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