## INDEX

### TO FIND FACTORIAL OF A NUMBER USING C PROGRAM

Code 1:
1. C code for factorial of a number
2. C program to find the factorial of a given number
3. Factorial program in c using while loop
4. Factorial program in c without using recursion

#include<stdio.h>
int main(){
int i=1,f=1,num;

printf("Enter a number: ");
scanf("%d",&num);

while(i<=num){
f=f*i;
i++;
}

printf("Factorial of %d is: %d",num,f);
return 0;
}

Sample output:
Enter a number: 5
Factorial of 5 is: 120

Code 2:
1. Factorial program in c using for loop
2. Simple factorial program in c
3. C program to calculate factorial

#include<stdio.h>
int main(){
int i,f=1,num;

printf("Enter a number: ");
scanf("%d",&num);

for(i=1;i<=num;i++)
f=f*i;

printf("Factorial of %d is: %d",num,f);
return 0;
}

Code 3:
1. Factorial program in c using pointers
2. How to calculate factorial in c
3. Factorial program in c language

#include<stdio.h>

void findFactorial(int,int *);
int main(){
int i,factorial,num;

printf("Enter a number: ");
scanf("%d",&num);

findFactorial(num,&factorial);
printf("Factorial of %d is: %d",num,*factorial);

return 0;
}

void findFactorial(int num,int *factorial){
int i;

*factorial =1;

for(i=1;i<=num;i++)
*factorial=*factorial*i;
}

Code 4:
1. Factorial program in c using function
2. C program to find factorial of a number

#include<stdio.h>

int findFactorial(int);
int main(){
int i,factorial,num;

printf("Enter a number: ");
scanf("%d",&num);

factorial = findFactorial(num);
printf("Factorial of %d is: %d",num,factorial);

return 0;
}

int findFactorial(int num){
int i,f=1;

for(i=1;i<=num;i++)
f=f*i;

return f;
}
Sample output:
Enter a number: 8
Factorial of 8 is: 40320

Code 5:
1. Factorial series in c

#include<stdio.h>
int main(){
long f=1;
int i,num,min,max;

printf("Enter the minimum range: ");
scanf("%d",&min);

printf("Enter the maximum range: ");
scanf("%d",&max);

printf("Factorial series in given range: ");
for(num=min;num<=max;num++){
f=1;

for(i=1;i<=num;i++)
f=f*i;

printf("%ld ",f);
}

return 0;
}

Sample output:
Enter the minimum range: 1
Enter the maximum range: 10
Factorial series in given range: 1 2 6 24 120 720 5040 40320 362880 3628800

Algorithm:

Factorial value

Factorial of number is defined as:
Factorial (n) = 1*2*3 … * n
For example: Factorial of 5 = 1*2*3*4*5 = 120
Note: Factorial of zero = 1

10. Write a c program to add two numbers without using addition operator.
11. Write a c program to subtract two numbers without using subtraction operator.
15. Write a c program to solve quadratic equation.
18. Write a c program which passes structure to function.
28. Write a c program which takes password from user.
29. Write a scanf function in c which accept sentence from user.
30. Write a scanf function in c which accept paragraph from user.

1. thankzz a lot for this program!!

2. Love u Tintu7/22/08, 10:53 PM

Thanx a lot for this program.

3. really thanks for this program.
this is very helpfull for me to learn how to write programs without any teacher's help.
thanks alot...........

1. this programe is not enough

4. thaks a lot...

5. thx bro really helped me :)

6. thnks a lott..

7. thanks for this code !!!!

8. nice one dude!!!!!1

9. I got an idea 2 write a program myself by seeing this page

10. i got idea 2 write program.. thanks...

11. thank u very much

12. nice one

13. thanks you

14. thanx dude

15. plz send me ans.

16. tenk u for ur program....jejeje

17. Thak you for publishing c programs,all are very useful.......

18. abid javed....

yr program perfect nia hy.......

19. Thank you so much for the programs, it was really helpful, :)

20. Thanks for usefull ideas

21. Thank u very much..I am practising my own programs

22. thank u very much to this program..........

23. factorial using two variables?

24. superb.......!!!

25. Thank you guys that's really helpful for me! You saved me!!:)

26. Guys can uplz post a prog for finding factorial for numbers above 10 as the range of 11! exceeds int and so here is the logic but i am not able to code it
example 5!=120
A[0]=0,A[1]=2,A[2]=1
6!=720=6*5!
6*A[0]=0;6*A[1]=12;6*A[2]=6;
now removing the 1 from A[1]=12 i.e A[1]=2;and adding it to A[2]i.e A[2]=7 and then reversing the array
i.e A[0]=7,A[1]=2,A[2]=0 and displaying it i.e 6!=720 similarly for 7!=5040 u can try but using this logic plz code the program

1. To find the factorial of very large number like 1000 go through following link:
Factorial of big numbers by c program

2. //factorial of large numbers
#include
#include
void calculate(int*,int);
void print(int*,int);
#define max 10000
//int max =100000000000;
int main()
{ int i,j,a[max],n;
printf("enter the no to find factorial\n\n");
scanf("%d",&n);
a[0]=1;
for(i=1;i<=max;i++)
a[i]=0;

for(i=1;i<=n;i++)
{for(j=0;j=10)
{rev=a[k]%10;
p=a[k]/10;
a[k+1]+=p;
a[k]=rev;
}

//print(a,i);
}

void print(int *a,int i)
{
// printf(" ipp is %d",i);

int l,c=0;
printf("factorial of %d is\n\n",i);
for(l=max-1;l>=0;l--)
{ if((a[l]==0)&&(c==0))
continue;
printf("%d",a[l]);
c=1;

}
printf("\n\n");
}

27. can u provide program of factorial with arguments nd no return value

1. Check the Code1

28. i need ur helps how can i write a program in c++ to take input from user and it must show it as asterisk using for or while loop.plz

29. The recursive solution of the above problem(ques 1).

#include
main()
{
int num;
scanf("%d\n",&num);
printf("%d",fact(num));
}
int fact(int num)
{
if(num == 1)
return 1;
return fact(num-1)*num;
}

30. can I get the "stack" program in c now plzzzzzzz

31. Can I get the program palindrome using stack

32. have u any gw basic program and some short information about it

33. Facebook page for programming concepts is
Codecommunity

34. thanks

35. how to print factorial of a number when user enters 52 input will be between 1 and 100

36. thanks pretty much guys

37. thanks guys pretty much

38. really cool thinkin

40. Factorial of a number

Write a program to find the factorial of a number using functions.

Function Specification:

int factorial(int n)

The function accepts a int and returns an int.

Input Format:

Input consists of 1 integer.

Output Format:

Output consists of a single integer. Refer sample output for formatting details.

Sample Input:

3

Sample Output:

6

41. can u help me for this

42. its nice code.
http://www.techcrashcourse.com/2014/10/c-program-find-factorial-of-number.html