View Code of Problem 70

#include<stdio.h>
#include <string.h>
int main(){
	float a,b,c,d,e,p;
	int g,n;
	scanf("%d",&g);
	a=100000*0.1;
	b=a+100000*0.075;
	c=b+200000*0.05;
	d=c+200000*0.03;
	e=d+400000*0.015;
	n=g/100000;
	switch(n){
		case 0:p=g*0.1;break;
		case 1:p=a+(g-100000)*0.075;break;
		case 2:
		case 3:p=b+(g-200000)*0.05;break;
		case 4:
		case 5:p=c+(g-400000)*0.03;break;
		case 6:
		case 7:
		case 8:
		case 9:p=d+(g-600000)*0.015;break;
		case 10:p=e+(g-1000000)*0.01;break;
		default:;
		
	}
	printf("%.0f",p);
	printf("\n");
	return 0;
}

Double click to view unformatted code.


Back to problem 70