Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- using namespace std;
- int main()
- {
- int amount;
- double ans = 20;
- scanf("%d", &amount);
- if(amount <= 0) {
- printf("You have entered an invalid amount! - please enter a valid number");
- return 0;
- } else if (amount > 50) {
- printf("book limit was exceeded");
- return 0;
- } else if (0 <= amount && amount <= 9) {
- ans -= ans*5/100;
- } else if (10 <= amount && amount <= 14) {
- ans -= ans*10/100;
- } else if (15 <= amount && amount <= 19) {
- ans -= ans*15/100;
- } else if (20 <= amount && amount <= 49) {
- ans -= ans*20/100;
- }
- ans *= amount;
- printf("%f", ans);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement