View Code of Problem 70

#include<stdio.h>
int main()
{
	int  money=0;
	int x;
	int t;
	scanf("%d",&x);
	if(x>1000000)
	{
		t=x-1000000;
		x=x-t;
		money+=(t*0.01);
	}
	if(x>600000)
	{
		t=x-600000;
		x=x-t;
		money+=(t*0.015);
	}
	if(x>400000)
	{
		t=x-400000;
		x=x-t;
		money+=(t*0.03);
	}
	if(x>200000)
	{
		t=x-200000;
		x=x-t;
		money+=(t*0.05);
	}
	if(x>100000)
	{
		t=x-100000;
		x=x-t;
		money+=(t*0.075);
	}
	if(x>0)
	{
		money+=(x*0.1);
	}
	printf("%d",money);
	
	return 0;
}

Double click to view unformatted code.


Back to problem 70