Factorial Example in C Programming

#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;
}

4
3
Awgiedawgie 440220 points

                                    //Factorial of a given number
#include &lt;stdio.h&gt;

//This function returns factorial of the number passed to it 
long int factorialOf(int number){
    long int factorial = 1;
    while(number){
        factorial*=number;
        number-=1;
    }
    return factorial;
}

int main(void) {
	int n;
	printf(&quot;Find factorial of \n&quot;);
	scanf(&quot;%d&quot;,&amp;n);
	printf(&quot;\nThe factorial of %d is %ld&quot;,n,factorialOf(n));
	return 0;
}

4 (3 Votes)
0
4
6
Awgiedawgie 440220 points

                                    #include &lt;stdio.h&gt;
 
int main()
{
  int i, num, fact = 1;
 
  printf(&quot;Enter Number to Calculate Factorial: \n&quot;);
  scanf(&quot;%d&quot;, &amp;num);
  
  for (i = 1; i &lt;= num; i++){
      fact = fact * i;
  }
    
  printf(&quot;Factorial of %d = %d\n&quot;, num, fact);
 
  return 0;
}

4 (6 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
factorial built in c factorial in in c write a c program to find factorial of the given number N factoraial in c factorial c function factorial value of any number in c C factorial funtions creat a c program to finde factorial number factors of a given number in c c program to find a factorial of a number using for loop[ factorials in c Create a C Program to find factorial of number creat a c program to find factorial number factorisation in c find the factorial of a number using for loop in c how to write a factorial function in c program to print factorial of a number in c factorial functin in c factorial finding function using c getting a factorial in c factorial algorithm in c check factorial number in c factorial of number using pointer in c c program for a factorial of a number Write a program in C that takes a variable n from user and calculates the factorial of n using for loop factorial program in c using do while loop factorial program in c by using function factorial function program in c Write a C program to calculate factorial of a number? 4. Write a C program to calculate factorial of a number? write a c program to find all factor of a number? Factorail in C c program factorial of a number Write a C program to find the factorial of a number and count the total number of itteration. factorial function in c is there a factorial function in c factorial functuion in c factorial of a number using while loop c factorial of a number in c using do while loop simple c program for finding factorial of a number how find factorial works in c calculate the factorial of a number in c factorial of two numbers program in c what is factorial c: n factorial formula in c factorial of a number in c while Write a C program to find factorial of a given integer Factorial Example in C Programming factorial of number using fuction in c program calculates the factorial of any entered number using while loop in c c program to compute factorial of a number c program to execute factorial factorial in c using while Write a C program to find the factorial of a number and also find the value of nCr using this function. how does factorial work in c factorial sum program in c factorial program in c using function factorial math code in c factors of a number in c factorial func in c Write a program in C to display factorial of any given number. develop c program to find the factorial of a number Write a program in C to calculate Factorial of a user given number. how to return a factorial in c c program for factorial using while loop write a c program to calculate the factorial of a number formule for factorial in c Write a function in C that will find the factorial of a given number. . Write a C program to calculate the factorial of a given number write a c program to calculate the factorial of a given number c program to calculate the factorial of a number Write a program in C to find out the factorial value of n. using function factorial condition in c factorial in c using for loop factorial in c using while loop geeksforgeeks factorial in c using while loop to find factorial of a number in c factorial logic in c c programming factorial function c programming factorial finding factorial in c using functions Write a C program to find the factorial of a number using while loop factorial of a number using c calculate many factorials numbers in c calculate factorial loop numbers in c calculate factorial of 10 numbers in c how to calculate factorial of a number in c c programming language factorial compute factorial in c to find the factorial of a given number in loop in c to find the factorial of a given number in loops in c write a c program to calculate factorial of a number factorial operator in c how to write a c program that return a factorial of given number factorial math in c factorial using iteration in c factorial program in c using iteration c program to print factorial of a number using while loop find factor of two number in c what is factorial.c factorial of a number in c using while loop factorial using c C program to find factorial of a number. c program to find factorial of number large number factorial using c to calculate factorial of a number in c c program to find factorial c code factorial function calculate factorial of a number in c write a c program to find a factorial using functions Write a C program to calculate the factorial of a given number. factorila in c factorial for n numbers in c factorial using while loop in c factorial operator in c. factoril code in c calculate factorial with C c program for factorial of a large number factorial formula in c program to find 2 factors of a number in c program to find factors of a number in c factorial code c factorial using for loop C how to find factorial of a number in c using function small factorial program in c factorial built in function in c Write a C Program to calculate factorial of a number using the function. how to find the factors of a number in c program to find factorial of a number in c factorial of a no c find factorial in c language factorial program in c using factorial of a number ij c factorial in c using function factorial of a number in c language my factorial c language c program to find factorial of the given number c calculate factorial how to find factorial a number in c how to factorial a number in c how to factorize a number in c find the factorial of a natural number &lsquo;n&rsquo;. in c c program to calculate factorial of a number factorial problem in c factorial of c HOW To find factorial in c program for factorial of a number in c c program to find factorial of a number using iteration factorial of number C calculate factorial in c using function calculate factorial in c factorial of a number using iteration in c factorial of a number c program geeks i/factorial in c factorial using function in c Write a C program to find the Factorial of a given number factorial nuumber program in c factorial in c how to do a factorial in c factorial with for loop c how to factoriel in c conditions for factorial in c c program factorial factorial number program in c factorial of a number in c program wap ic find factorial Program to display factorial of a given number find the factorial of a number c WRite factorial program in C#? C programme to find the factorial of given number factorial of a number c Write a C program that reads an integer n from the keyboard and prints out the factorial of n. factorial of a number using for loop how to use factorial in c programming factorial of a numbe rusing functions in c c program that calculates the factorial of a number c program to find factorial of a number using function why is my factorial program not working in c how to find the factorial of a number in c Write a program to compute factorial of an integer entered by the user factorial calculator in c facrorila function in c write a c program to calculate factorial factorial for loop factorial with a for loop in c factorial.c write a program for factorial of a number wap to print factorial of a number program to calculate factorial of a number factorial ftn in c WAP to print the factorial of a number.(using for loop) factorial prgm in c program to find the factorial of a number c factorial program by forloop c factorial program factorial of n numbers in c factorial of a given examples in c factorial using recurino in c how to make a for loop in c to calculate the factorial of a number formula for factorial in c with loop formula for factorial in c factorial type for c factorial of number program write a program to find out the factorial of a given number Digital factorial IN C find the factorial of a number in c program to find a factorial of a number Calculate the factorial of a given number. (given number prompt by the user) factorial of laze number in c code for factorial program to find factorial of a 3 digit number finding factorial c factorial of number c programm to print 10 factorial making factorial in c programming Write a Program to print the Factorial of a number in c and check if the last digit of the number contains 2 or not. Print a proper message accordingly. 5 factorial in c Write a program to find the factorial of the given number N. how to factorial in c factroical in c c program for factorial of n numbers c code for factorial using for loop print the factorial of a given number in c print n factorial find factorial of n c# explain factorial program in c types of factrorial program in c how to calculate factorial in c factorial of number in c who to do Factorial in c Write a program to find out the factorial of a number how to get factorial of a number in c fiactorial program in c WAP to calculate the factorial of a given number write a c program to find factorial of a number feactorial in c Write a c program to find factorial of given positive number Write a program to calculate factorial of a number. factorooal logic interactive factorial orgram write a program to find the factorial of a number factorial of n using functio in c c language factorial function c program to find the factorial of a number write a C program to find the factorial of a given number. how to do factorial in c facotial in c factorial c factorial pattern in c write factorial in C Write a C program to display the factorial of a given number, n c program for factorial of a number c program factorial of given number factorial in c programming Enter an integer and The factorial of in c programming c program to print factorial of a number from 1 to 20 wap to find the factorial of a given number c factorial code how to find factorial c program factorial c program using for loop finding factorial in c C program to display for a factorial of a number factorial program in c using for loop write a program to find factorial of number program a factorial factorial of a number in c C factorial for loop factorial of a number c program factorial of individual digits in c program for factorial factorial program in c c program to print factorial of a number write a program to find factorial of a number factorial c program factorial of a number c program for factorial factoriual in c wap to fctorial of number what is the code for farctorialinc program factorial program c factorial write a program to find the factorial number in c factorial function c program to find factorial of a number c calc the faculty of numbers find factorial of a number in c how to print factorial in c how to find factorial of a number in c factorial code in c factorial using for loop Write a function which will use a FOR loop to compute the factorial of n factorial of a number c++; factorial function in c simple logic for factorial factoril logic factorial logic c code for factorial till which number does factorial support in c factorial code c factorial function factorial numbers logic factorial sample program c program to find factorial of a number facrorial in c programming factorial in c factorial of a given number in c
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source