java+project+2

/** factorial solver


 * @author Danny Fell



import java.util.Scanner; // imports the scanner

public class factorialSolver {

public static void main(String[] args) {

double fact = 1; // initializes value of fact, the number multiplied to the user input number

Scanner kbd1 = new Scanner (System.in);

System.out.println ("Enter the number you want to know the factorial of "); //asks the user for the number they want to know the factorial of

double num = kbd1.nextDouble ; // sets of the value of num to be user input

double i = 1; // sets the value of i

if (num <= 0) //makes sure the number is above 0

System.out.println ("factorial is not defined");

else

{

while (i<=num) // sets up the math for factorial function

{

fact *= i ; // the math for the factorial function

i += 1;

}

System.out.println("Factorial of " + num + " = " + fact);// tells user what the factorial of their input number is

} }

}