View Code of Problem 70

#include <stdio.h>
void main(){
	double l,j;
	int n;
	scanf("%lf",&l);
	n=l/100000;
	switch(n)
	{
	case 0:
		j=(l*0.1);
		break;
	case 1:
		j=100000*0.1+(l-100000)*0.075;
		break;
	case 2:
	case 3:
		j=100000*0.1+100000*0.75+(l-200000)*0.05;
		break;
	case 4:
	case 5:
		j=100000*0.1+100000*0.75+200000*0.05+(l-400000)*0.03;
		break;
	case 6:
	case 7:
	case 8:
	case 9:
		j=100000*0.1+100000*0.75+200000*0.05+200000*0.03+(l-600000)*0.15;
		break;
	case 10:
		j=100000*0.1+100000*0.75+200000*0.05+200000*0.03+400000*0.15+(l-1000000)*0.01;
		break;
	}
	printf("%.f",j);
}

Double click to view unformatted code.


Back to problem 70