Factorial Program In C Using Pointers With Example. If you are looking for a factorial program in C with pointers example, this C programming tutorial will help you to learn how to find the factorial of a number. Just go through this C programming example to calculate the factorial of a positive integer, you will be able to write an C program for factorial using pointers.
Factorial Program in C Using Pointers
Table of Contents
- Factorial Program in C with Pointers
- Factorial Program in C using Pointers Source Code
- Factorial Program in C using Pointers Output
- C Programming Tutorials
- C Programming Examples
Factorial Program in C with Pointers
C Programming Tutorials
- Factorial Program in C Using While Loop
- C Program For Factorial Using For Loop
- Factorial Program in C Using Recursion Function
- C Program For Palindrome String
- C Program For Palindrome Numbers
- C Program To Reverse a String with Using Function
- C Program To Reverse a String without Using Function
- C Program To Reverse a String Using Recursion
Factorial Program in C using Pointers Source Code
Copy the below program to find the factorial of a number using pointers or write your own logic by using this program as a reference. Paste the factorial program into C compilers and run the program to see the result.
/* C PROGRAM FOR FACTORIAL USING POINTERS - FACTORIAL.C */ #include<stdio.h> void findFactorial(int,int *); //function int main(){ int i,factorial,n; printf("Enter a number: "); scanf("%d",&n); findFactorial(n,&factorial); printf("Factorial of %d is: %d",n,*factorial); return 0; } void findFactorial(int n,int *factorial){ int i; *factorial =1; for(i=1;i<=n;i++) *factorial=*factorial*i; }
Factorial Program in C using Pointers Output
After you compile and run the above factorial program in c to find the factorial of a number using pointers, your C compiler asks you to enter a number to find factorial. After you enter your number, the program will be executed and give output like below expected output.
Factorial of 7 is: 5040
C PROGRAMMING EXAMPLES
- C Program To Reverse a String Using Pointers
- C Program To Swap Two Numbers Using Two Variables
- C Program To Swap Two Numbers Using Three Variables
- C Program For Prime Numbers – Check a Number is Prime or Not
- C Program To Reverse a String with Using Function
- C Program to Reverse a String without Using Function
- C Program to Reverse a Sting Using Recursion