Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // FCTRL.c
- // 11. Factorial
- //
- // Created by Catarina Moreira on 09/01/13.
- // Copyright (c) 2013 Catarina Moreira. All rights reserved.
- //
- #include <stdio.h>
- int main(int argc, const char * argv[])
- {
- int NUM_TESTS;
- scanf("%d", &NUM_TESTS); // read total test cases from input
- int t;
- for (t = 0; t < NUM_TESTS; t++)
- {
- unsigned long long INPUT;
- scanf("%llu", &INPUT); // read input data
- unsigned long long result = 0;
- while( INPUT )
- {
- result += INPUT/5; // for every multiple of 5 add the respective ...
- INPUT /= 5; // ... num of zeros to the result
- }
- printf("%llu\n", result);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement