View Code of Problem 70

#include<stdio.h>
#include<stdio.h>
int main()
{
	int x,y;
	scanf("%d",&x);
	if (x<=100000)
		y=x*(1+10%);
	else if(x>100000&&x<=200000)
		y=100000*(1+10%)+(y-x)*(1+7.5%);
	else if (x>200000&&x<=400000)
		y=200000*(1+10%)+(y-x)*(1+5%);
	else if(x>400000&&x<=600000)
		y=400000*(1+10%)+(y-x)*(1+3%);
	else if(x>600000&&x<=800000)
		y=600000*(1+10%)+(y-x)*(1+1.5%);
	else 
		y=1000000*(1+10%)+(y-x)*(1+1%);
	printf("%d",y);
	return 0;

}
/*
Main.c: In function 'main':
Main.c:8:13: error: expected expression before ')' token
   y=x*(1+10%);
             ^
Main.c:10:18: error: expected expression before ')' token
   y=100000*(1+10%)+(y-x)*(1+7.5%);
                  ^
Main.c:12:18: error: expected expression before ')' token
   y=200000*(1+10%)+(y-x)*(1+5%);
                  ^
Main.c:14:18: error: expected expression before ')' token
   y=400000*(1+10%)+(y-x)*(1+3%);
                  ^
Main.c:16:18: error: expected expression before ')' token
   y=600000*(1+10%)+(y-x)*(1+1.5%);
                  ^
Main.c:18:19: error: expected expression before ')' token
   y=1000000*(1+10%)+(y-x)*(1+1%);
                   ^
*/

Double click to view unformatted code.


Back to problem 70