1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
#include<stdio.h>
#include<math.h>
void main ()
{
int price, subtotal, total, tax, tender;
float change;
int changeInDollars=0;
int changeInCents=0;
int Twenties, Tens, Fives
sum=0
;
do
{
printf("Please enter a series of prices, to stop enter "0""\n);
scanf("%d",&price);
getchar();
sum +=price;
} while (price != 0);
return 0;
}
tax=sum*.0825;
total=tax+sum
printf("Your subtotal is "%d", sum"\n);
printf("Your tax is "%d", tax"\n);
printf("Your total is "%d", total"\n);
}
printf("Please enter tender"\n);
scanf("%d", &tender);
getchar();
printf("You have paid "%d", tender"\n);
if (tender<total)
{
printf("Please enter appropriate tender\n",x);
}
else (tender>=total)
{
change=tender-total
system("pause");
printf("Your changes is:$ %.2f\n", change);
Twenties = int(change/20);
change -= Twenties * 20;
printf("Twenties: %i\n",Twenties);
Tens = int(change/10);
change -= Tens * 10;
printf("Tens: %i\n",Tens);
Fives = int(change/5);
change -= Fives * 5;
printf("Fives: %i\n",Fives);
int dollars = int(change/1);
change -= dollars;
printf("Dollars: %i\n",dollars);
change *= 100;
int quarters = int(change/25);
change -= quarters * 25;
printf("Quarters: %i\n",quarters);
printf("Thank you come again!\n");
getchar();
return EXIT_SUCCESS;
}
|