20.factorial using for loop
// factorial using for loop import java.util.*; class factorial { public static void main(String arg[]) { int f = 1, no, a; Scanner obj = new Scanner(System.in); System.out.print("Enter any number : "); no = obj.nextInt(); for(a = 1; a <= no; a++) { f = f * a; } System.out.println("Factorial : " +f); } }