View Code of Problem 70

#include<stdio.h>
int main(){
    int n;
   while (scanf("%d",&n)!=EOF) {
       int k;
       if (n <= 100000) {
           k = n * 0.1;
       } else if (n <= 200000) {
           k = 10000 + (n - 100000) * 0.075;
       } else if (n <= 400000) {
           k = 17500 + (n - 200000) * 0.05;
       } else if (n <= 600000) {
           k = 27500 + (n - 400000) * 0.03;
       } else if (n <= 1000000) {
           k = 33500 + (n - 600000) * 0.015;
       } else if (n > 1000000) {
           k = 39500 + (n - 1000000) * 0.01;
       }
       printf("%d\n", k);
   }
    return 0;
}

Double click to view unformatted code.


Back to problem 70