Advertisement
Sierra_ONE

Receipt

Sep 30th, 2023
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.74 KB | Source Code | 0 0
  1. #include <stdio.h>
  2.  
  3. #define VAT 12
  4. int main (void){
  5.     float item1, item2, item3, cash, change, total;
  6.    
  7.     printf("Item 1: ");
  8.     scanf("%f", &item1);
  9.     printf("Item 2: ");
  10.     scanf("%f", &item2);
  11.     printf("Item 3: ");
  12.     scanf("%f", &item3);
  13.     printf("Cash: ");
  14.     scanf("%f", &cash);
  15.    
  16.     printf("______________________________\n");
  17.    
  18.     printf("\nCorned Beef %18.2f", item1);
  19.     printf("\n1P Snowbear %18.2f", item2);
  20.     printf("\n555 Sardines 2Pcs %12.2f", item3);
  21.    
  22.     printf("\n------------------------------\n");
  23.    
  24.     total = item1 + item2 + item3;
  25.    
  26.     float value = total * VAT / 100;
  27.    
  28.     change = cash - total;
  29.    
  30.     printf("\nTotal: %23.2f", total);
  31.     printf("\nChange: %22.2f", change);
  32.     printf("\nVAT: %25.2f", value);
  33.    
  34.    
  35.    
  36.    
  37.    
  38.    
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement