Computer Science, asked by subigyashrestha77, 2 months ago

Write an algorithm and draw a flowchart to find factorial of a number.

Answers

Answered by samarthkrv
0

Answer:

import java.util.*;

class factorial

{

public static void main(String args[])

 {

 Scanner scanner = new Scanner(System.in);

 int fact = 1;

 int num = scanner.nextInt();

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

  {

  fact = fact * (i+1);

  }

  System.out.print(fact);

 }

}

Explanation:

sample input 6

output is 720

Similar questions