C program to check factorial, C/C++ Programming

C Program to check FACTORIAL

 

main()

{

            int i,j,m,fact,sum=0;

          clrscr();

          printf("ENTER THE NO.: ");

          scanf("%d",&m);

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

          {

                   fact=1;

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

                             {

                                      fact=fact*j;

                             }

                    printf(" %d * ",i);

          }

          sum=sum+fact;

          printf(" = %d",sum);

          getch();

}

 

OUTPUT :

ENTER NO: 5

1 * 2 * 3 * 4 * 5 * = 120

Posted Date: 9/10/2012 2:09:45 AM | Location : United States







Related Discussions:- C program to check factorial, Assignment Help, Ask Question on C program to check factorial, Get Answer, Expert's Help, C program to check factorial Discussions

Write discussion on C program to check factorial
Your posts are moderated
Related Questions
Define  T y pe c o m p a t i b i li t y? T o a s s i g n i n t t o s m a l l i n t t h e v a r i a b l e should b e

Relational Operators A relational operator is used to make comparison among two values. All these operators are binary and needs two operands. There are the following relationa

Define Polymorphism? A: Polymorphism let a client to treat distinct objects in the similar way even if they were developed from distinct classes and exhibit different behaviors.

Floating  literal They can be written in common decimal as well as scientific notation (floating point representation). By default it is of type double. F, L is applied only to

Write in a file: void main() { int i,j,k,l,list[1000]; FILE *fp; char any[8];   cout cin >> any;   fp = fopen(any,"wb");     for(j=0;j     {

Question 1 / 1 You have an N x N chessboard and you wish to place N kings on it. Each row and column should contain exactly one king, and no two kings should attack each other (two

Compound Assignment Operators Apart from the binary and the unary arithmetic operators, we also have compound assignment operators. These are +=, -=, *=, /=, %=. Using these op

Class Definition The following is the general format of defining a class template: class tag_name                  {                    public  :               // Must

Write a program to define a matrix: 1. Write a function that takes an integer and calculates and returns the factorial of the integer. The Factorial of a number "n" is compute

Objects as Function Arguments: In C program there are several methods to define arguments, and in some case even a structure can be approved as an argument.  Similarly in C+