Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.11 KB | None | 0 0
  1. //==============================================
  2. // Name:           Sifat Dipta
  3. // Student Number: IDK
  4. // Email:          sdipta@myseneca.ca
  5. // Section:        XXX
  6. // Workshop:       2 (in-lab)
  7. //==============================================
  8.  
  9. #define _CRT_SECURE_NO_WARNINGS
  10.  
  11. // Start your code below:
  12.  
  13. #include <stdio.h>
  14.  
  15. int main(void) {
  16.     printf("Please enter the amount to be paid: $");
  17.     double ammountPaid;
  18.  
  19.     scanf("%lf", &ammountPaid);
  20.     //printf("%lf\n", ammountPaid);  // Test User Input
  21.    
  22.     double rLoonies = ammountPaid / 1;
  23.     int a = rLoonies;
  24.     double balanceOwe = rLoonies - a;  //0.68
  25.  
  26.     printf("Loonies required: %d, balance owing %0.2lf\n", a, balanceOwe);
  27.  
  28.     double rQuarters = balanceOwe / 0.25;
  29.     int b = rQuarters;
  30.     double quarterEquals = b * 0.25;
  31.     double leftOver = rQuarters - quarterEquals;
  32.     printf("Quarters required: %d, balance owing %0.2lf\n", b, leftOver);
  33.     /*------------------------------------------
  34.  
  35.    
  36.     double rQuarters = rLoonies / 25;
  37.     //b = a - ammountPaid;
  38.  
  39.     printf("Loonies required: %d\n", a);
  40.     printf("%.0lf\n", rQuarters);
  41.     //printf("%d", b);*/
  42.     return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement