View Code of Problem 118

#include<stdio.h>
#include<math.h>
#include<string.h>

int main()
{
    int n,k = 1;

    while(scanf("%d",&n) != EOF)
    {
        if(n <= 3)
            printf("Case #%d: 5\n",k++);
        else
        {
            float sum = (float)5+(n-3)*1.5;
            if(sum == (int)sum)
                printf("Case #%d: %d\n",k++,(int)sum);
            else
                printf("Case #%d: %d\n",k++,(int)(sum+1));
        }
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 118