Estoy pidiendo por consola digitos para sacar factorial, pero al utilizar Long solo puedo sacar hasta el factorial de !65, despues de !66 da 0. Entonces necesito imprimir Factorial < 66 = infinito, de lo contrario (else if) haga ciclo, pero me da error. ¿Desearia saber si el "else if" se puede utilizar de esta forma? Ahi deje un comentario señalando donde me da error. (linea 21). GRACIAS DE ANTEMANO
import java.util.*;
public class Program
{
public static void main(String[] args) {
int fristInput = 0;
int secondInput = 0;
Scanner entrada = new Scanner(System.in);
System.out.print("Digite un valor: ");
fristInput=entrada.nextInt();
evenAndOdd(fristInput);
System.out.print("Digite un valor: ");
secondInput=entrada.nextInt();
evenAndOdd(secondInput);
if(fristInput<66&&secondInput<66){
System.out.println("Factorial de: "+fristInput+"es : Infinito ");
}else if{ //<- Aqui me da error :(
while(fristInput <= secondInput){
System.out.println("Factorial of: "+fristInput+ ", is equals to: "+proccessFact(fristInput));
fristInput++;
}
}else{
while(fristInput >= secondInput){
System.out.println("Factorial of: "+fristInput+ ", is equals to: "+proccessFact(fristInput));
fristInput--;
}
}
evenAndOdd(fristInput,secondInput);
}
public static long proccessFact(int valorCalcular){
long factorial=1L;
for(int i=valorCalcular;i>0;i--) {
factorial=factorial*i;
}
return (factorial);
}
public static void evenAndOdd(int number){
if (number % 2 == 0)
System.out.println("The "+number+" is even.");
else
System.out.println("The "+number+" is odd.");
}
public static void evenAndOdd(int number1, int number2){
if (number1%2 == 0){
System.out.println("The "+number1+" is even.");
}else{
System.out.println("The "+number1+" is odd.");
}
if (number2%2 == 0){
System.out.println("The "+number2+" is even.");
}else{
System.out.println("The "+number2+" is odd.");
}
}
}