Print out the factorials from 1-100. First use integers. What happens? and why? Then use BigInteger... I had it working using the following code but my prof is being picky and wants me to do it another way :{

import javax.swing.*; public class FactorialMethod { public static void main(String[] args) { long start = 0; System.out.println("The factorials from 1-100 are:"); factorial(start); } public static void factorial(long start) { int counter = 1; double factorial = 0; int x; while (counter<=100){ System.out.print("Factorial of " + counter + " is"); factorial = counter/counter; for (x=counter; x>0; x--){ factorial = factorial*x; } System.out.print(" " + Math.abs(factorial) + "\n\n"); counter++; } } }

as i said the above logic was not acceptable; so, i started from scratch and have come up with the following. unfortunately there is an error in my factorial method relating to a missing return statement. Does anyone have any ideas?

import java.util.*; import java.math.*; public class FactorialMethod2 { public static void main(String[] args) { int counter = 1; int start = 0; System.out.println("Factorials from 1-100 are: "); factorial(counter); factorial(start); } //return factorials for 1-100 public static int factorial(int counter){ counter = 1; int factorial = 0; int x; while (counter<=100){ System.out.print("Factorial of " + counter + " is"); factorial = counter/counter; for (x=counter; x>0; x--){ factorial = factorial*x; if (counter == 0) return 1; else return counter * factorial( counter-1 ); //recursive call } } } }