View Code of Problem 70

#include<stdio.h>
int main(){
	long int x,y;
	y=0;
	int i;
	scanf("%d",&x);
	if(x<=100000) i=1;
	if(x>100000&&x<=200000) i=2;
	if(200000<x&&x<=400000) i=3;
	if(400000<x&&x<=600000) i=4;
	if(600000<x&&x<=1000000) i=5;
	if(x>1000000) i=6;
	switch(i){
	  case 6:y=y+(x-1000000)*0.01;
      case 5:y=y+(x-600000)*0.015;
      case 4:y=y+(x-400000)*0.03;
      case 3:y=y+(x-200000)*0.05;
      case 2:y=y+(x-100000)*0.075;
      case 1:y=y+x*0.1;break;
    }

	printf("%ld",y);
}

Double click to view unformatted code.


Back to problem 70