Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- typedef unsigned long long ull;
- ull fact(ull x) {
- if (x == 0) {
- return 1;
- }
- ull ans = 1;
- for (ull i = 2; i <= x; i++) {
- ans *= i;
- }
- return ans;
- }
- int main(void) {
- ull x;
- scanf_s("%llu", &x);
- printf("%llu", fact(x));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement