SHARE
TWEET

Untitled

a guest Oct 21st, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int amount;
  8.     double ans = 20;
  9.     scanf("%d", &amount);
  10.     if(amount <= 0) {
  11.         printf("You have entered an invalid amount! - please enter a valid number");
  12.         return 0;
  13.     } else if (amount > 50) {
  14.         printf("book limit was exceeded");
  15.         return 0;
  16.     } else if (0 <= amount && amount <= 9) {
  17.         ans -= ans*5/100;
  18.     } else if (10 <= amount && amount <= 14) {
  19.         ans -= ans*10/100;
  20.     } else if (15 <= amount && amount <= 19) {
  21.         ans -= ans*15/100;
  22.     } else if (20 <= amount && amount <= 49) {
  23.         ans -= ans*20/100;
  24.     }
  25.  
  26.     ans *= amount;
  27.  
  28.     printf("%f", ans);
  29.  
  30.     return 0;
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top