Created
August 6, 2014 17:41
-
-
Save pareshchouhan/fbb7326d88ba603fbf26 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdint.h> | |
| #include <inttypes.h> | |
| uint64_t fact(uint64_t n); | |
| int main() | |
| { | |
| int t, n, r,i; | |
| scanf("%d",&t); | |
| for ( i =0 ; i < t ; i++) { | |
| scanf("%d %d",&n,&r); | |
| printf("%"PRIu64"\n",(uint64_t)(fact(n)/(fact(r) * fact(n-r)))); | |
| } | |
| return 0; | |
| } | |
| uint64_t fact(uint64_t n) { | |
| return (uint64_t)((n == 1 || n == 0) ? 1 : (n * fact(n-1))); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment