Small Factorial||codechef||beginner solution ||programming info

Small Factorial

Write a program to find the factorial value of any number entered by the user.

Input

The first line contains an integer T, the total number of testcases. Then T lines follow, each line contains an integer N.

Output

For each test case, display the factorial of the given number N in a new line.

Constraints

  •  T  1000
  •  N  20

Example

Input
3 
3 
4
5

Output

6
24
120
SOLUTION USING C LANGUAGE:-
#include <stdio.h>
int facti(int n)
            {
             if(n>0)
                 return(n*facti(n-1));
             else 
             return 1;
            }
int main() {
            int t,i,n;
                scanf("%d\n",&t);
                for(i=0;i<t;i++)
                {
                    scanf("%d\n",&n);
                    printf("%d\n",facti(n));
                }
            	// your code goes here
            	return 0;
            }
Share:

1 comment:

  1. factorial hundred In the last few days, the “factorial of 100” is one of the top subjects and a lot of maths geeks compute it using voice assistants such as Alexa, Shiri, etc.

    factorial hundred In the last few days, the “factorial of 100” is one of the top subjects and a lot of maths geeks compute it using voice assistants such as Alexa, Shiri, etc.


    factorial hundred In the last few days, the “factorial of 100” is one of the top subjects and a lot of maths geeks compute it using voice assistants such as Alexa, Shiri, etc.


    ReplyDelete

Translate

Recommended platforms

  1. codechef
  2. hackerrank
  3. codeforces
  4. leetcode
  5. hackerearth

Popular Posts

programming_info. Powered by Blogger.

Blog Archive

Recent Posts

other platforms

  • geeks for geeks
  • w3schools
  • codepen
  • skillshare
  • udemy

Pages

reader support Support