, , 57, :
57 , :2 () 20 1 () 10 1 () 5 2 () 1. 2 . twenties = amount/20. amount, twenties int, . , 20 amount. , . twenties , , 20 , .
. 2. ,
, , 20 , : ? , . 20 , , 10 . . , %. r20 = amount % 20 r20 , amount 20. , , 20, . 20 40 , 17 . 17 tens.
, twenties, tens fives. ones 5.
, . , float, , , float. :
main(){floatcost, shipping, total;cost = 56.09;shipping = 4.98;total = cost + shipping;printf(" %.2f \", total);}, , :
|
|
61.07
. . :
main(){int total;float cost, shipping;cost = 56.09;shipping = 4.98;total = cost + shipping;printf(" %d ", total);}float (cost shipping), total. , 61.07, total , . %d 61.
.3. ,
, , (.3). , 60 (56+4).
, float:
main(){int cost, shipping;float total;cost = 56;shipping = 4;total = cost + shipping;printf(" %.2f \ ", total);}, total %f, . , , 60.00.
float int , . :
main(){intshipping;floattotal, cost;cost = 56.09;shipping = 4;total = cost + shipping;printf(" \%.2f ", total);}int float, foat (60.09).
. : , , float, , , () . .4 , . float. , .
. 4.
, . . :
main() { intcount; count = 5; printf(" %d", count+19); }:
|
|
printf() count+19. () . %d.
. , count+19, count - 5. , , .
, , :
printf("%d", count+number);printf("%d", 16-4);printf(%f", amount*TAX_RATE);, . , , . :
main() { floatcost, shipping; printf(" : "); scanf("%f", &cost); printf(" : "); scanf("%f", &shipping); printf(" %f", cost+shipping); }printf(" %f", cost+shipping);
, :
total = cost + shipping;/*total float*/printf(" %f", total);. , , , . , printf(). , , , , , cost+shipping.
, , . , .
, - , - . , .