C program for function of find the factorial , C/C++ Programming

C Program for FUNCTION OF FIND THE FACTORIAL

float factorial(float);

void main()

{

          float i=0,c=0;

          clrscr();

          printf("ENTER THE DIGIT TO FIND THE FACTORIAL: ");

          flushall();

          scanf("%f",&i);

          c=factorial(i);

          printf("THE FACTORIAL OF %f IS %f",i,c);

          getch();

}

float factorial(float i)

{

          float j=0,k=1;

          for(j=1;j<=i;j++)

          {

                   k=k*j;

          }

          return(k);

}

OUTPUT :

ENTER THE DIGIT TO FIND THE FACTORIAL : 5

THE FACTORIAL OF 5 IS 120.000

Posted Date: 9/10/2012 8:01:33 AM | Location : United States







Related Discussions:- C program for function of find the factorial , Assignment Help, Ask Question on C program for function of find the factorial , Get Answer, Expert's Help, C program for function of find the factorial Discussions

Write discussion on C program for function of find the factorial
Your posts are moderated
Related Questions
Raj is a newbie to the programming and while learning the programming language he came to know the following rules: · Each program must start with ''{'' and end with ''}''

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

1)      Factorial (for this question just provide an answer for each part)  1.1  Debug the following program to calculate N! #include using namespace std; main()

Program is to append the contents of one file to another: void main()    {   clrscr();   fstream file1,file2;   char st1[13],st2[13];/* 13 because a filename canno

Write a Program to illustrate the Call by Reference? Here is an illustration: #include . int compute_sum(int *n); int main( void) { int n=3, sum; printf("%d\n",n); /

manupulates operator precidence

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Based on the automobile's model year and weight, the city of Cebu determines the car's weight class and registration fee using the following schedule: Model Year Registration

Problem : (a) Stacks can be implemented using arrays. Write down the following C or C++ function to (i) create a stack (ii) add an element to a stack (push). (b) Expl

Create a program that asks the user for two integers which represent the numerator and denominator parts of fraction. Print out a simplification of the fraction. Example: Enter th