Title: ?etat??p? ??f??se?? se C
1?etat??p? ??f??se?? se C
- m2 - n2
- ax2 bx c
- -b 4ac
- 2ab
- cd
- ((-a)b) ((-c)d)
2?etat??p? ??f??se??
- m2 - n2 mm - nn ? (mm)-(nn)
- ax2 bx c axx bx c
- -b 4ac -b 4 a c
- 2ab (2ab)/(cd)
- cd
- ((-a)b)((-c)d) -ab -cd
3?p????? ??p?? ?ed?µe???
- ?a??te? se e?a s???e??
- ?a???, ?a?a
- ?µßad?, ?????
- ???µa
- ????µ?? ?a?t?t?ta?
4?p????? ??p?? ?ed?µe???
- ?a??te? se e?a s???e?? int
- ?a???, ?a?a float, double
- ?µßad?, ????? float, double
- ???µa char (string)
- ????µ?? ?a?t?t?ta? int
5?a??de??µa
- ?????aµµa p?? ?p??????e? t? a????sµa, d?af??a,
????µe??, p????? ?a? modulo ??a d?? a?e?a????
a???µ???. ?? d?? a???µ?? p?epe? ?a d?aßast??? ap?
t?? ???st?.
6include ltstdio.hgt main() int numbera,
numberb / inputs/ int sum, difference,
product, ratio, modulo /results/ printf(Ente
r two integer numbers ) /get
data/ scanf(dd,numbera, numberb) sum
numbera numberb / compute
results/ difference numbera -
numberb product numbera numberb ratio
numbera / numberb modulo numbera
numberb / display output / printf(The sum
of d and d is d\n,numbera, numberb,sum)
printf(The difference of d and d is
d\n,numbera, numberb,difference) printf(The
product of d and d is d\n,numbera,
numberb,product) printf(The ratio of d and d
is d\n,numbera, numberb,ratio) printf(The
mod of d and d is d\n,numbera,
numberb,modulo)
7?a?ade??µa
- G?a?ete p????aµµa p?? ?p??????e? ?a? t?p??e? t??
pe??µet?? ?a? eµßad? e??? ??????. ?? µ???
ded?µe?? e??a? ? a?t??a t?? ?????? se µet?a.
8/ program that computes the perimeter and area
of a circle/ include ltstdio.hgt define
PI 3.14259 /program constant/ main() float
radius / variable for input data/ float
perimeter, area /variable for output
data/ /GET INPUT DATA/ printf(This program
computes the area and perimeter of a
circle\n) printf(Enter radius of a circle in
meters ) scanf(f,radius) /COMPUTE
PERIMETER AND AREA/ perimeter 2 PI
radius area PI radius radius /PRINT
RESULTS/ printf(A circle with radius f m has
perimeter f m and area f sq. m\n, radius,
perimeter, area)
9E????? (selection)
- S?????? e?? if
- S??ta??
- if (e?f?as?)
- e?t???
- if (e?f?as?)
- e?t???
- ..
-
10E????? (selection)
- S?µas?a ea? ? e?f?as?(s??????) pa???e? t?µ?
d?af??? t?? µ?de? t?te e?te????ta? ??
e?a?t?µe?e? e?t??e? a????? s??e??se µe t??
e?t??e? p?? a?????????? t? if block - if (length lt 0)
- printf(error length should be possitive\n)
- exit(0)
11??f?as? S???????
- S?????t???? te?este? (int, char, float, double)
- gt lt gt lt
- p? agtb, altb, a gtb, altb, a b
- S?µas?a ea? s?????s? ?s??e? ? t?µ? t?? e?f?as??
e??a? 1 a????? 0
12- int number, count
- ..
- if (number lt 0)
- count count 1
-
- printf(d\n, count)
- .
- number count output
- 2 3
13?pa?a???? (repetition)
- ??t??? while
- S??ta??
- while (e?f?as?)
- e?t???
- while (e?f?as?)
- e?t???
- ..
-
14while (s??)
- S?µas?a ?s?? ? t?µ? t?? e?f?as?? (s???????)
e??a? d?af??? t?? µ?de? e?te?a t?? e?a?t?µe?e?
e?t??e? a????? s??e??se µe t?? e?t??e? p??
a?????????? t? while block - int x0
- while(xlt5)
- printf(d\n,x)
- x x 1
-
15while (s??)
16while (s??)
- x xlt5 output
- 0 1 0
- 1 1 1
- 2 1 2
- 3 1 3
- 4 1 4
- 5 0
17while (s??)
- int x
- x0
- while(xlt5)
- / do something using x/
- x x 1
-
18?p?s??
- ???e ??f?as? st?? C pa???e? t?µ? (t?p??)
- Programming ?lock
- d???s?d???s? e?t??? e?t???
- ??f?ase??
- a 3 a ((t x)/e) p
- b PI square(radius)
- if (size(list) b)...
- while (x lt (ab))...
19Programming Block
void main() / d???se?? ?a? e?t??e?
/ while(/some test condition/) / d???se??
?a? e?t??e? / if(/some test
condition/) / d???se?? ?a? e?t??e? /
20G?a?ete e?a p????aµµa p?? t?p??e? t??? a?e?a????
a???µ??? ap? t? -10 µe??? t? 10. ? ?a?e a???µ??
?a t?p??eta? se ?e????st? ??aµµ?.
21include ltstdio.hgt main() int i / loop
counter / i -10 while(ilt10) printf(d\
n,i) i i 1
22G?a?ete e?a p????aµµa p?? t?p??e? t??? a?e?a????
a???µ??? ap? t? 1 µe??? t? 12. ?a?e a???µ?? p??
d?a??e?ta? µe t? 3 ?a t?p??eta? d?p?a t??. ?
?a?e a???µ?? ?a t?p??eta? se ?e????st? ??aµµ?.
23include ltstdio.hgt main() int i / loop
counter / i 1 while(ilt12) printf(d,i)
if((i3) 0) printf() print
f(\n) i i 1
24Trace Table
i ilt12 i3 (i3) 0 output
?e???? t?µ? t?? i