Created
January 20, 2013 03:38
-
-
Save rizaldim/4576539 to your computer and use it in GitHub Desktop.
code chef atm problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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