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
write a c++ program for the sum of 10 numbers and print out the average


Question 1 What are the different steps in executing a C program? Explain Question 2 What are the commonly used input/output functions in C? How are they accessed?

Q: When should you employ multiple inheritance? A:There  are  three  acceptable  answers:-  "Rarely," "Never," and  "while  the  problem  domain cannot be modeled accurately any

Program is to perform string operations: Program is to perform string operation without using in built functions using classes and object void mainmenu()    {    clrs

Imagine that the server program is a setuid program owned by the root, then after you penetrate the program with a shell running, you become the ROOT and you can remove the whole f

Explain the Formatted Input Output with Strings? These are the third set of the scanf and printf families. They are called sscanf and sprintf. sprintf Puts formatted dat

Find out the largest torque: A flat belt is taken in use to transmit torque from pulley A to pulley B as shown in figure given below. The radius of each pulley is 50mm and co

Project Description: I need to convert AFL code of Amibroker to DLL plugin to hide original formula, and also to protect the DLL and making it hardware locked. I need to wrap th

C++ improves on many of C's features and provides object-oriented programming capabilities used for software production, quality and reusability. C++ was developed by Bjarne Strons