Computer Programming Contest Preparation

ToolBox - Source for: 100/10079/a.c



/home/toolbox/public_html/solutions/100/10079/a.c
    1 #include <stdio.h>
    2 #include <string.h>
    3 #include <sys/types.h>
    4 #include <sys/stat.h>
    5 #include <fcntl.h>
    6 #include <stdint.h>
    7 #include <math.h>
    8 #include <stdlib.h>
    9 
   10 #define TRUE  (1 == 1)
   11 #define FALSE (1 != 1)
   12 
   13 #define DEBUG if (FALSE)
   14 
   15 /*
   16  *  Author: Isaac Traxler
   17  *    Date: 2015 02 10
   18  * Purpose:
   19  * Problem: 10079
   20  */
   21 
   22 /*
   23  * This template reads data until a terminating value is reached.
   24  */
   25 
   26 long long num;
   27 long long total;
   28 
   29 void init()
   30 {
   31     /* FUNCTION init */
   32 } /* FUNCTION init */
   33 
   34 void dump()
   35 {
   36     /* FUNCTION dump */
   37 } /* FUNCTION dump */
   38 
   39 int getInput()
   40 {
   41     /* FUNCTION getInput */
   42     int dataReadFlag;
   43 
   44     scanf(" %lld ", &num);
   45     dataReadFlag = 0 <= num;
   46     return (dataReadFlag);
   47 } /* FUNCTION getInput */
   48 
   49 void process()
   50 {
   51     /* FUNCTION process */
   52     total = num * (num + 1) / 2 + 1;
   53     printf("%lld\n",  total);
   54 } /* FUNCTION process */
   55 
   56 int main()
   57 {
   58     /* main */
   59     int moreToDo;
   60 
   61     init();
   62     moreToDo = getInput();
   63     while (moreToDo)
   64         {
   65             /* while */
   66             process();
   67             moreToDo = getInput();
   68         } /* while */
   69 
   70     return EXIT_SUCCESS;
   71 } /* main */
   72