answersLogoWhite

0

#include<stdio.h>

#include<conio.h>

int factr(int x);

void main()

{

int a,fact;

printf("\n Enter a value: ");

scanf("%d",&a);

fact=factr(a);

printf("\n Factorial: %d",fact);

getch();

}

int factr(int x)

{

int f,i;

f=1;

for(i=x;i>=1;i--)

f=f*i;

return f;

}

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

What is a Flow chart for finding factorial of a given number using recursion function?

no answer....pls post


What is a factorial function in Visual Basic?

' Iterative solution Function iterativeFactorial(ByVal n As Long) As Long Dim factorial As Long = 1 For i As Long = 1 To n factorial *= i Next Return factorial End Function ' Recursive solution Function recursiveFactorial(ByVal n As Long) As Long If n &lt;= 1 Then Return n End If Return n * recursiveFactorial(n - 1) End Function


How do you find factorial of a given number using function in C.?

Use the following function: unsigned fact (const unsigned n) { return n&lt;2 ? 1 : n * fact (n-1); } Note that for a 32-bit unsigned integer, the largest factorial this function can accommodate is 12!


Write a recursive procedure to compute the factorial of a number?

#include &lt;iostream&gt; using namespace std; int main() { int i, number=0, factorial=1; // User input must be an integer number between 1 and 10 while(number&lt;1 number&gt;10) { cout &lt;&lt; "Enter integer number (1-10) = "; cin &gt;&gt; number; } // Calculate the factorial with a FOR loop for(i=1; i&lt;=number; i++) { factorial = factorial*i; } // Output result cout &lt;&lt; "Factorial = " &lt;&lt; factorial &lt;&lt; endl;


What is a recursive function?

A recursive function is one that calls upon itself until a given result in the original call is met. Take a look at this example. Program Recursion; Uses crt; Var number:longint; Function Factorial(number:longint):longint; Begin if number &gt; 0 then factorial:=number*factorial(number-1) else factorial:=1; End; Begin clrscr; readln(number); writeln(factorial(number)); readln; End. Note how the function factorial calls itself.


What does an exclamation point symbol right next to a number do to the number?

An exclamation mark after a number is the symbol for the factorial function.


How do you find factors of a number in Excel spreadsheet?

Use the FACT function. So to get the factorial of 5, you would enter:=FACT(5)Use the FACT function. So to get the factorial of 5, you would enter:=FACT(5)Use the FACT function. So to get the factorial of 5, you would enter:=FACT(5)Use the FACT function. So to get the factorial of 5, you would enter:=FACT(5)Use the FACT function. So to get the factorial of 5, you would enter:=FACT(5)Use the FACT function. So to get the factorial of 5, you would enter:=FACT(5)Use the FACT function. So to get the factorial of 5, you would enter:=FACT(5)Use the FACT function. So to get the factorial of 5, you would enter:=FACT(5)Use the FACT function. So to get the factorial of 5, you would enter:=FACT(5)Use the FACT function. So to get the factorial of 5, you would enter:=FACT(5)Use the FACT function. So to get the factorial of 5, you would enter:=FACT(5)


Programming to calculate a factorial number?

double factorial(double N){double total = 1;while (N > 1){total *= N;N--;}return total; // We are returning the value in variable title total//return factorial;}int main(){double myNumber = 0;cout > myNumber;cout


Program for finding the factorial of the two given number using constructor?

kjhk


How do you write a program that calculate factorial in javascript?

factorial number Var num= prompt(&quot;enter any number &quot;); Var i=1; Var fact=1; for(i=1;i


By using call by reference find the factorial of a number?

chutia mc,bc bhosdika


How can you get the number 25 by using only number 4?

(4 times 4 factorial + 4) divided by 4 4 factorial + the square root of 4 minus (4 divided by 4)