View Code of Problem 70

#include<stdio.h>
void main()
{
	int i,s;
	scanf("%d", &i);
	if (i <= 100000)
		s = 0.1*i;
	else if (i > 100000 && i <= 200000)
		s = 10000 + (i - 100000)*0.075;
	else if (i > 200000 && i <= 400000)
		s = 17500 + (i - 200000)*0.05;
	else if (i > 400000 && i <= 600000)
		s = 27500 + (i - 400000)*0.03;
	else if (i > 600000 && i <= 1000000)
		s = 33500 + (i - 600000)*0.015;
	else
		s = 39500 + (i - 1000000)*0.01;
	printf("%d", s);
}

Double click to view unformatted code.


Back to problem 70