Search
 
SCRIPT & CODE EXAMPLE
 

C

factorial in c

/*
Factorial Program in C: Factorial of n is the product of all positive 
descending integers. Factorial of n is denoted by n!. 
For example:
5! = 5*4*3*2*1 = 120  
3! = 3*2*1 = 6  
*/

#include<stdio.h>  
int main()    
{    
 int i,fact=1,number;    
 printf("Enter a number: ");    
  scanf("%d",&number);    
    for(i=1;i<=number;i++){    
      fact=fact*i;    
  }    
  printf("Factorial of %d is: %d",number,fact);    
return 0;  
}   
Comment

factorial c program using for loop

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

c program to find the factorial of a number

#include <stdio.h>
int main() {
    int n, i;
    unsigned long long fact = 1;
    printf("Enter an integer: ");
    scanf("%d", &n);

    // shows error if the user enters a negative integer
    if (n < 0)
        printf("Error! Factorial of a negative number doesn't exist.");
    else {
        for (i = 1; i <= n; ++i) {
            fact *= i;
        }
        printf("Factorial of %d = %llu", n, fact);
    }

    return 0;
}
Comment

factorial of a number in c

#include<stdio.h>
void main(){

    int num, i, mul;
    num = 5;
    mul = 1;
    for(i = 1; i <= 5; i++){
        mul = mul * i;
    }
    printf("%d",mul);

}
Comment

for any factorial numbers in c

int fact=1;
	for(int i=1;i<=100;i++)
	{
		fact=((fact%97)*(i%97))%97;
		
	}
	printf("%d
",fact);
Comment

funtion factorial c

function factorial
Comment

factorial of a number in c

factorial
Comment

PREVIOUS NEXT
Code Example
C :: text berjalan html 
C :: set value of boolean in c 
C :: .sh template 
C :: add a item to cart woocomerce with quantity 
C :: c style string 
C :: c sleep milliseconds 
C :: read from stdin c 
C :: enable disable audio listener unity 
C :: fgets remove newline 
C :: struct main function c in unix 
C :: How to Convert double to int in C 
C :: bootsrap textbox 
C :: c loop 
C :: how to make a check bigger 
C :: link list c 
C :: millis() 
C :: c median of an array 
C :: apt-mark remove hold 
C :: . Simulate MVT and MFT. 
C :: c check if character is upper case 
C :: how to join an array of strings c 
C :: virtualbox how to move vmdk to another folder 
C :: check for duplicates c 
C :: C Syntax of goto Statement 
C :: two way communication between child and parent processes in C using pipes 
C :: solutionadda 
C :: c fibonacci series recursion 
C :: C - Type Casting 
C :: how to stop aws alb temporarily 
C :: unigine 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =