write a program of factorial number.(java program )
Answers
Answered by
4
P iS the product.c is the loop control variable.Java program given below
Attachments:
estherroyin:
I'm from Kerala
Answered by
3
Answer:
import java.util.Scanner;
public class Test
{
public static void main ( String args[ ] )
{
int num, i, fact ;
Scanner sc = new Scanner ( System.in) ;
System.out.print(" Enter number : ") ;
num = sc.nextInt( ) ;
fact = 1 ;
for( i=1 ; i < = num ; i++)
{
fact *= i ;
}
System.out.println(" Factorial of" + num + "is:" + fact) ;
}
}
Example output :
Enter number : 6
Factorial of 6 is : 720
Similar questions