Java Code for Finding the Factorial of a Number
Java? ?code? ?for? ?finding? ?the? ?factorial? ?of? ?an? ?entered? ?number 1). ? ?/** ? ?? ?*? ?Enter? ?Name ? ?? ?*? ?Enter? ?Class? ?Period ? ?? ?*? ?Teacher? ?Name ? ?? ?*? ?Enter? ?Date ? ?? ?*/ class? ?Factorial{ public? ?static? ?void? ?main(String? ?args[]){ ? ?int? ?LetterI,fact=1;? ?? ?//declare? ?integers ? ?int? ?number=5;? ?//enter? ?number? ?to? ?find? ?the? ?factorial? ?of ? ?? ?for(LetterI=1;LetterI<=number;LetterI++){ fact=fact*LetterI; ? ?} System.out.println("Factorial? ?of? ?"+number+"? ?is:? ?"+fact);? ?? ?? ?? ?//displays? ?the? ?factorial? ?of? ?the number ? ?} }