Computer Science, asked by aditikumari86, 10 months ago

WAP to find a factorial of a given number?​

Answers

Answered by arsh122100
5

Answer:

Example: Factorial of a Number

#include <stdio.h>

int n, i;

unsigned long long factorial = 1;

printf("Enter an integer: ");

scanf("%d",&n);

// show error if the user enters a negative integer.

if (n < 0)

printf("Error! Factorial of a negative number doesn't exist.");

Answered by gaganadithyareddy9
0

Answer:

Hey! Here is your code in python...

def factorial(n):

   prod = 1

   

   while n>=1:

       prod*=n

       n = n-1

       

   return prod

x = int(input("Enter a number: "))

f = factorial(15)

print("Factorial of", x, '=', f)

# HOPE THIS HELPS!!

Similar questions
English, 5 months ago