ATM problem to slow?

int cash,balance;
float saldo;
scanf("%d",&cash);
scanf("%d",&balance);

if(cash%5!=0 || cash+0.5>balance){
	printf("%d",balance);
	return 1;
}

else
	saldo=balance-cash-0.5;
	printf("%.2f",saldo);
	return 3;

My solution seems to be too slow. Any ideas?

You must return 0, as 0 is the value returned on success. If you return any other value from main, it will be considered as some run-time error.

  1. the variable balance should be of float type and not int.

2)For all online judges , you should always return 0; from main and not any other value like 1 or 3.This was the cause of the NZEC error.Refer to this FAQ for future reference.

here is an accepted version of your code

I mean itś run time error, has an error somewhere…

Thanks man!! Should have guessed