Computer Science, asked by tejasatyasai4449, 1 year ago

Create a function named factorial () which accept an integer number and print its factorial. Output will be as:

Answers

Answered by amannishad0512p5zxh6
0

class Fact

 {

            public void factorial(int n)

            {

                 int i,f=1;

                  for(i=1;i<=n;i++)

                  {

                       f*=i;

                      }

System.out.println("Factorial  is "+f);

                }

public static void main()

 {

     Fact ob=new Fact();

         ob.factorial(15);

      }

}

Hope it will help you @

Ask if not got and follow me to answer your more java questions.

Mark me brainlest @

Similar questions