repo.or.cz
/
letusc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
move to repo.or.cz
[letusc.git]
/
ch2
/
examples
/
example2.c
blob
7904599585949e3404b49869954a8b8d770d86b3
1
#include<stdio.h>
2
3
/* calculation of total expenses*/
4
5
6
int
main
(
void
)
7
{
8
int
qty
;
9
float
rate
;
10
int
dis
;
11
float
expense
;
12
13
printf
(
"Enter quantity and rate per item: "
);
14
scanf
(
"%d %f"
,&
qty
,&
rate
);
15
16
if
(
qty
>
1000
)
17
dis
=
10
;
18
19
expense
= (
rate
*
qty
)-(
0.10
*
rate
*
qty
);
20
21
printf
(
"The total expense is %.2f
\n
"
,
expense
);
22
23
return
0
;
24
}