View Code of Problem 118

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

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

Double click to view unformatted code.


Back to problem 118