Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void){
- int num;
- long factorial = 1;
- printf("Enter a number: ");
- scanf("%d", &num);
- long orignum = num;
- while (num > 1){
- factorial *= num;
- num -= 1;
- }
- printf("Factorial of %d is %ld", orignum, factorial);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement