Computer Science, asked by adrijadattahcs, 4 days ago

write a program to display the factorial of any ten numbers.
[Hint: Factorial of 5! = 5*4*3*2*1]


Please, anyone, help me with this

Answers

Answered by sudiptakotal02
1

Answer:

import java.util.Scanner;

public class KboatFactRange

{

public static void main(String args[]) {

Scanner in = new Scanner(System.in);

System.out.print("Enter m: ");

int m = in.nextInt();

System.out.print("Enter n: ");

int n = in.nextInt();

if (m < n && m > 0 && n > 0) {

for (int i = m; i <= n; i++) {

long fact = 1;

for (int j = 1; j <= i; j++)

fact *= j;

System.out.println("Factorial of " + i + " = " + fact);

}

}

else {

System.out.println("Invalid Input");

}

}

}

Answered by anitanama784
0

Answer:

INPUT number

SET factorial := 1, i := 1

WHILE i <= number DO

COMPUTE factorial := factorial * i

INCREASE i by 1

END LOOP

PRINT factorial

Similar questions