factorial of a given number in c
//Factorial of a given number
#include <stdio.h>
//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("Find factorial of \n");
scanf("%d",&n);
printf("\nThe factorial of %d is %ld",n,factorialOf(n));
return 0;
}
Also in C:
- ordenar un vector
- ruby find object in array by attribute
- c for
- c program hide console window
- execute maven project in cmd
- printf("%3d ",XX);
- how to run a update comand in linux
- switch statement in c
- XAudio2 C
- vue router.push with params
- stack
- jsdocs returns
- molotovn't ribbentropn't pact
- what is i686 vs x86_64
- cannot update windows 10
- error 403
- main function in c
- how to input a string into a char array cpp
- import a library in c
- !isdigit c
- how can i remove a specific item from an array
- fread
- how to rebasde
- pointer offset notation