Skip to content

Instantly share code, notes, and snippets.

@rizaldim
Created January 20, 2013 03:38
Show Gist options
  • Select an option

  • Save rizaldim/4576539 to your computer and use it in GitHub Desktop.

Select an option

Save rizaldim/4576539 to your computer and use it in GitHub Desktop.
code chef atm problem
#include <stdio.h>
int main()
{
int amount;
float saldo;
const double FEE = 0.5;
scanf("%d %f", &amount, &saldo);
if (
((amount + FEE) <= saldo) && // kalau cukup saldo
(amount % 5 == 0) // dan kalau jumlah yang ditarik kelipatan $5
)
saldo -= (amount + FEE);
printf("%.2f\n", saldo);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment