View Code of Problem 70

#include <stdio.h>
#include <stdlib.h>
#include<ctype.h>
#include<string.h>
#include<math.h>
int main()
{
	long int x, y;
	while (scanf("%ld", &x)!=EOF)
	{
		if (x <= 100000)
			y = x * 0.1;
		else if (100000 < x&&x <= 200000)
			y = 10000 + (x - 100000)*0.075;
		else if (200000 < x&&x <= 400000)
			y = 10000 + 7500 + (x - 200000)*0.05;
		else if (400000 < x&&x <= 600000)
			y = 10000 + 7500 + 10000 + (x - 400000)*0.03;
		else if (600000 < x&&x <= 1000000)
			y = 10000 + 7500 + 10000 + 6000 + (x - 600000)*0.015;
		else y = 10000 + 7500 + 10000 + 6000 + 6000 + (x - 1000000)*0.01;
		printf("%ld\n", y);
	}
	
	
	return 0;
}

Double click to view unformatted code.


Back to problem 70