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;
}//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:
- first person view unity
- inurl:fiu.edu math faculty
- uint32_t extract first bits
- sublime text
- diamond dataset in r
- PS1 modified lags
- if statement in c
- c remove element from array
- what is constructor
- markdown empty line
- c matrix sintax
- how do pointers work in c programmwiz
- java.lang.SecurityException: Permission denied (missing INTERNET permission?)
- how to create random integers from a specific range in c language
- C printf to string
- even odd c
- find factoril in C using recursion
- is animal crossing for kids
- declare variable in c
- doubly linked list c
- how can i remove a specific item from an array
- linux_reboot_magic2
- toggling setting clearing checking changing a bit in c
- arduino ip to string