.


:




:

































 

 

 

 


1. .




4

, , , . , . , , , , . , .

. , , . , , . .1, :

= = +


.1.

 

, , . , , . , .

:

+
*
/
%

, ( x), ( \).

, . . , :

sales_tax = 4500;

, . , :

sales_tax = amount * tax_rate;price = cost + shipping + insurance;per_unit = total / count;

, :

  • sales_tax , amount tax_rate;
  • price , : cost, shipping insurance;
  • per_unit , total count.

, , . , , , :

sales_tax = amount * 0.06;price = 56.90 + shipping + 7.87;per_unit = 156.65 / 12.50;

1 . , . (10 ) (6 ). , puts() printf().

 

 

1. .

/*invoice.c*/#define TAX_RATE 0.06#define SHIPPING 0.10main(){char name[15], address[20], city[15],state[3], zip[6];float order, total, tax, ship;printf(": ");gets(name);printf(": ");gets(address);printf(": ");gets(city);printf(": ");gets(state);printf(":");gets(zip);printf(": ");scanf("%f", &order);tax = order * TAX_RATE;ship = order * SHIPPING;total = order + tax + ship;puts("\n\n\n\n");puts(" \n");printf("%s\n%s\n%s, %s %s\n", name, adress, city, state, zip);printf("\t\t\t\t%-10s\t%10.2f\n", ":", order);printf("\t\t\t\t%-10s\t%10.2f\n", ":", tax);printf("\t\t\t\t%-10s\t%10.2f\n", ":", ship);printf("\t\t\t\t\t\t______________\n);printf("\t\t\t\t%-10s\t%10.2f",": ",total);}

% . (/) , . , 12 5 (12/5) 2, 2.4. , 0.4, .

, . , 0.4, float. . , 12 5, . 2 , %. .

2. , , , . , , , , . , , .





:


: 2017-03-12; !; : 282 |


:

:

.
==> ...

1521 - | 1446 -


© 2015-2024 lektsii.org - -

: 0.01 .