Computer Programming Contest Preparation

ToolBox - Source for: 102/10220/c.c



/home/toolbox/public_html/solutions/102/10220/c.c
    1 #include <stdio.h>
    2 
    3 #define TRUE  (1 == 1)
    4 #define FALSE (1 != 1)
    5 
    6 int input;
    7 
    8 int getInput()
    9 {
   10     // BEGIN FUNCTION getInput
   11     int returned;
   12     returned = scanf(" %d ", &input);
   13     if (EOF == returned)
   14         {
   15             return 0;
   16         }
   17     return 1;
   18 
   19 } // END FUNCTION getInput
   20 
   21 int process()
   22 {
   23     // BEGIN FUNCTION process
   24     unsigned long long int big = 1;
   25     int x;
   26     long int sum = 0;
   27 
   28     for (x = input; x > 1; x--)
   29         {
   30             big = big * x;
   31             while (0 == big%10)
   32                 {
   33                     big = big/10;
   34                     printf(".");
   35                 }
   36             printf("x:%d    %x\n",x, big);
   37         }
   38     /*while(big > 0)
   39     {
   40        sum += big%10;
   41        big/=big;
   42     }
   43     */
   44     printf(" %ld\n", big);
   45     return 0;
   46 } // END FUNCTION process
   47 
   48 int main ()
   49 {
   50     // main
   51     int moreToDo;
   52 
   53     //init();
   54     moreToDo = getInput();
   55     while (moreToDo)
   56         {
   57             // while
   58             process();
   59             moreToDo = getInput();
   60         } // while
   61 
   62     return 1;
   63 } // main
   64