Computer Science, asked by pathakshobha300033, 1 year ago

Write a program that will take a number N as input and print the factorial of all numbers from 1 to K
Number factorial
1 1
2 2
3 6
I I
I I
I I
N N1

Answers

Answered by parnad2018kolkata
3

Answer:

Explanation:

import java.util.*;

class prog

{  

public static void main(String args[])

{  

      Scanner sc=new Scanner(System.in);

int k=0;  

 System.out.println("Enter The value of N=");

   int n=sc.nextInt();

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

{    

  k=factorial(i);

System.out.println(n+"    "+k);

}

}

int factorial( int a)

{

  int p=1;

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

{

     p*=i;

}

return p;

}

}

#answerwithquality & #BAL

Similar questions