Computer Science, asked by koushikpaul1671, 11 months ago

Writea program to find the factorial value of any number entered through the keyboard

Answers

Answered by sswaraj04
7

Answer:

It's a C program

Explanation:

#include <stdio.h>

int main()

{

   int n;

   printf("Enter the number ");

   scanf("%d",&n);

   long fac=1;

   int m=n;

   while(n>1)

   {

       fac*=n;

       n--;

   }

   

   printf("Factorial of %d is %d",m,fac);

   return 0;

}

Hope it helps :-)

Answered by crpiyushbansal
0

Answer:

package com.company;

import java.util.Scanner;

public class square_10 {

   public static void main(String[] args) {

       Scanner sc = new Scanner(System.in);

       System.out.println("ENTER THE VALUE OF N");

       int f=sc.nextInt();

       int fac=1;

       for(int i=f; i>0; i--){

           fac=fac*i;

       }

       System.out.println(fac);

   }

}

Explanation:

Similar questions