Computer Programming Contest Preparation

ToolBox - Source for: naq/naq2022/f.c



/home/toolbox/public_html/solutions/naq/naq2022/f.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 #include <ctype.h>
   10 
   11 #define TRUE  (1 == 1)
   12 #define FALSE (1 != 1)
   13 
   14 #define DEBUG if (FALSE)
   15 
   16 #define MAX_LINE 257
   17 
   18 /*
   19  *  Author: Isaac Traxler
   20  *    Date:
   21  * Purpose: fun
   22  * Problem: NAQ - f
   23  */
   24 
   25 /*
   26  * This template reads lines of data at a time until end of file.
   27  */
   28 
   29 int a;
   30 double b;
   31 double four;
   32 
   33 void init()
   34 {
   35     /* FUNCTION init */
   36 } /* FUNCTION init */
   37 
   38 void dump()
   39 {
   40     /* FUNCTION dump */
   41 } /* FUNCTION dump */
   42 
   43 void getInput()
   44 {
   45     /* FUNCTION getInput */
   46     scanf(" %d ", &a);
   47 } /* FUNCTION getInput */
   48 
   49 void process()
   50 {
   51     /* FUNCTION process */
   52     four = 4.0;
   53     b = a /  four;
   54     if (0 == (a % 2))
   55         {
   56             /* even case */
   57             printf("%.1lf\n", b);
   58         } /* even case */
   59     else
   60         {
   61             /* other cases */
   62             printf("%.2lf\n", b);
   63         } /* other cases */
   64 } /* FUNCTION process */
   65 
   66 int main()
   67 {
   68     /* main */
   69 
   70     init();
   71     getInput();
   72     process();
   73 
   74     return EXIT_SUCCESS;
   75 } /* main */
   76