Sale Season

Language : C
(NOTE : Try a few times yourself before moving to the solution)


#include <stdio.h>

int main(void) {
	int t;
	scanf("%d\n",&t);
	
	while(t--)
	{
	    int m;
	    scanf("%d\n",&m);
	    
	    if(m<=100)
	    printf("%d\n",m);
	    else if(m>100 && m <=1000)
	    printf("%d\n",m-25);
	    else if(m>1000 && m <=5000)
	    printf("%d\n",m-100);
	    else if(m>5000)
	    printf("%d\n",m-500);
	}
	return 0;
}

No comments:

Post a Comment