the program is to use nested loop or loop with a mathematical method.
to find factorial R= 1! + 2! +3! + 4! + 6! + …….. + 9! + 10!
import java.util.Scanner;
public class q3 {
public static void main (String[ ] args) {
System.out.println("Enter the number for factorial calculations : ");
Scanner scanner = new Scanner(System.in);
int a = scanner.nextInt();
double fact= 1;
System.out.println("Factorial of " +a+ ":");
for (int i= 1; i<=a; i++){
fact=fact*i;
} System.out.println(fact);
}
}
how to convert it to nested loop or math method

New Topic/Question
Reply



MultiQuote








|