ݺߣ

ݺߣShare a Scribd company logo
-1-
  ¡ ¢ £¥¤¦¨§©    
!  # $% ' $¥(! ) 0132 4)52 6
789A@¨BC D5E FBG HIB@ P H
QR STU VW¨X`Y
a bc de f ghiprqst¥u¥sv
w5xry3€‚ƒ„ yr…r†ˆ‡ ‚‰ y
‘’ “ ” •—–˜ ™ d`e fg d –
h i j5j`k`lm no ¨pq r`lh s tu5v w xy z5{`|z
} ~`¥€ ‚ ƒ „…~€†‡5ˆ¥ ‰
Š ‹ Œ¨Ž—‘’ Š “ ”r• – —
˜¥™ š› œ ž Ÿ
  ¡ ¢£ £
¤ ¥
¦ § ¨ © ª«¬ ­ ®
¯¨° ±²
³ ´ µ¶ · ¸`¹ º» ¼ ¸ ½ ¾ ¿À Á ¨ÃĨÅ
ÆÇ È É Ê`ËrÌͨÎÏ¥Ð Ñ Ò Ó ÔÕ Ö¨Ë
×Ø × Ù Ú Û Ü Ý ÞߥÜà Ý á Û â ãä ¨å æçè ¥é èê ç ëìí¨îrïð5ð`ñ òäè ó
ôõ ö ÷ ø`ùrúû¨üý¥þ ÿ   ¡£¢¥¤¥û ¦¨§ ©£  !£$#%' () $0 1 23 4 5 6876819$$7
@ A B C$DEF¨G$HPIPG8Q R ST UVG8W XY `aabc¨dPe f gh i pPqr sut v w
w x y €$‚ƒ¨„$…P†P„8‡ ˆ ‰ ‘V„8’ “” •—–P˜ ™ – deefg¨hPi j kl m nPop qur s t
t u r n$vwe¨x$yPhPx8z { |m }Vx8~ €£•£–P˜ ™ –€ deefg¨hPi j kl m nPop qur s t
t u r n$vwe¨x$yPhPx8z { |m }Vx8~ ‚ ƒ…„† ‡Vˆ ‰ŠŠ‹Œ¨PŽ  ‘ ’ “P”• –u— ˜ ™
š› œužŸ ¡$¢u£¤¥§¦¨¨© ª¨ ¢¢«
¬­ ® ¯ °
±² ³ ´ µ
¶· ¸ ¹ º» ¼½V¾£¿ À£¼$Á ¿ ¾¨ÃÄ¿ ÅÆ Ç¼ È$¾É ¾ ÊË $È$ÌÎÍ ÏÐVÑ » ¼$Ò Ó ÍÃÔ Ç¿ ÕÔ ÇÖ ×8Ñ » ¼$Ð
¶· ¶ Ø Ù Ú ÛÜ Ý$ÞPßáàà Ü âuãäPâuåÎæ$ççuâPèæVßVé æVÛ Ü Ý$çê ëæ8ì íVîï…ð8ñPòñPó ôõ ö ÷8ø ùú õû üýuþ õ
ÿ¡  ò ¢ ô ö £ ù ¤¦¥¨§áõõ ù ©¨©Î÷¦©¨÷§ ÷ ¨÷ !¦ #¤8õ¡$%¦!£ ù ¤¦ þ #÷ ! íVîï…ð8ñ ò ñ ÿ
ôõ ö ÷8ø ùú õû üýuþ õ
')( 01 23 54¡6¦70¡38
9@ A B CDE¨F G H)G I D¡C¦P%D¨F G P)G G QF¦QSR TF U¡V U A W X5U Y F
9@ ` a H)G bD¨G c5B deC¦G fa P)gh
i5p qrs%tu vw yx€%yw%r‚
ƒ„ … † ‡ ˆ ‰  ‘’“¨‘”y•–— •¦˜¦™)™edf ‘¨‡  gih —• ‰¡j ‰ k l ˆ m
ƒ„ k ’“¦‘¨”e•n op qr5n spr‰%m‘¡n jt•uh¦•‘¡n m‘v¨• w s• r5n m‘v¨• w mˆ • x¨mpxu‡%r•¦yn tlz…
™5–y–{ q |
})~ €¦‚ƒ„y…‡†
ˆ‰ Š ‹Œ )Ž¦‘’’¨‘ “ ¨” Œ •)–—¨’¨˜ •5™¨š › iœ%¦ž• Œ ’Ÿ—¨’ y‘
¡¢ £ ‹Œ )Ž¡¦‘’’¨‘ “ –¤ ‘¦¥¦”)”e¦§ ’¨¨ Œ 
¡¢ © ‹Œ 5Ž¡¦‘’’¨‘ “ ™¡¦”
ª5« ¬ ­5®%¯°¦±¨­ ² °¦³­´¨³
µ ¶ · ¸¹)º»¼ ½y¾¦¿¡À Á ÂÂÃÀ ÄÅ Ã)Æ Ç È É¦À Á Ê ËÌÆ¿¡ÍÎ)Á ÏɨÁ СÑ5ҦнÓÄ¦Ê Ô5Ò¦ÁÇ ÕÖ Ä¦ÆÊ ×eÒ¦Á ÇÍ Ø)ÙÌ È
ØyÚ ÛÜÝ Þß à5áâ Ý ãä åæç éè êë ì å à í¡î ïðñóò¦ôõ¨ö ÷ø¦ò¦ö õ¡ùúö ò
û úü ý¡þ ÿ ¢¡ ÿ£ ¤ ÿ ¢¡¦¥¨§ © ¨    !¨  # $ % %¦!¨  #$ % % '')( 0¨1)2  3 ( 4¨5¢(  !6% 780 '92  !¨4¨
-2-
 ¢¡¤£¦¥¨§© ¢¢ ¡¨ ¢££¦ 
!#%$' ( )0 12 43¨5'6
7'8@9ACBD ECF GIHA'PQG'R PQS9QP'T
U V'W XY ¢` a b cd¢efg hpi4q¨rts uCvCrtwx y€ ‚
ƒ „Q…¨† ‡ ˆ
‰‘¦‰ ’“Q”'•—–Q˜• ™ d—e f¢g—e‘“4h¢’“Q”%ei j4kjQlm¨nonqp rs¤t¤uvw j
x yz
{ |} #~€ '
~ |} #~€ '‚| }
~ ƒ%„†… ‡ ˆC‰
Š ‹ Œ¢Ž¨#¨‘@4’ “#”•¤–#”‘¨——˜¤‘q‘™ š›—œoŒo”Q 
ž¨Ÿ ž  ¡¢Q£¤¢%¥p¦¢§%¨© ª «#¬­¤®¨¯¨°%± ²³ ´Cµ—´Q¶—· ¸ ¹pº »¼ ½ ¾¿À Á ¾Â Á ÃÄ Å ÆÇ—È ÉÊËÌ ÍqÎ ÏÐ Ñ Ç¢Æ¤Ò¨ÃpÓ Ô Ñ Ë ÕÖ Q×#ÆpØ
Ù¨Ú Ù¨Ú Ù Û ÜÝ Þ ß¢à¤á¨âpã'à—äCåoæQçèæ%éߢêCë¢ë¢ì Û åíàoèêQæ Û åoæî¤ï¨ð Û ñ î¤ï¨ðóò#æݤߤèêQæ'ô õê Û àö¨àoèêQæ
÷ø4ù¨ú—û%û4ü¤ý—øþ¤ú—û ÿ   ¡ ¢ £¥¤ ¦¨§©©    ! $# %' (0)132 46587 9¥@
ACB ACB D E8FHG¥IQPSR$I T UQV W8XQVYFH`!aCRRcb de3f3E!V'g FhaCRHi `!fQf3Eb pq!r s tu¥vSw xy€‚3ƒ
„¨…S† ‡ˆ
„ ‰C† ‡ˆ $0‘!’ “¥‘
” •C– —˜ $™0d!e f¥dg— ˜
” h!– f¨ij— k l'm
nCo p q8rSs¥tQuSv$t w xQy z8{QyYrH|!}Cvvc~ €33q!y'‚ r —˜
nCo p3o n ƒ¥„ … ƒ¥†‡!ˆH‰ ŠC‹ Š Œ ŠC‹YŽH! ‘’3“3‡“Q” • –  —Š 3”''˜0†™ Œ '‹YŽH! ‘’3“3‡›š’3“œ‹' Žj˜0ˆ’3“CžC¨– ‹' Ž
ŸC  ¡3  ¡ ˆ• ¢c£C¤¤
if (condition) statement;
¥ ¦H§3¨'©3ª « ª §3¨ ¬­Q®°¯ ±­ ² ®8³3´Cµ¶ · ² ¸¥¹ º¨»¼¼ ½ ¾¿ À¯ ÁÂ!³ Ã$Ä Å'Æ ¹0Ç­3® È6É!Ê Ë¥Æ
Ì Í¨Î Ï6Î Ð!ÑÒÐ!Ó'Î ÔÕQÖ × Ø¨ÙQÚ3Û8×QÜ!Ý'Þ ß à Þ'á âÒ× Ø âCã Ýä à Ù8å3æCç0ã èé!å ê$ë ì'í
î × Ø âSïß8× Ø¨ÙQÚ3Û8×QÜ!Ý'ïQâ'ðQð!ñ òâ Só0åô àÝ hõ8ö¥÷ بÙCÝ!ÙQÚ ø òù ¥åð!úSÙ8û
ü0ýCþ'ÿHþ¡  ¢£¥¤§¦¨§©©¡  þ 
if (condition)
{
statement_1;
statement_2;
...
statement_n;
}
-3-
 ¢¡ £¤¡ ¥ ¦¨§¤©¨ ! $#©
 ¢¡ £¤¡ %  ' (¢)¨0 1 $#2 354 6 78
9 @BABCED$F¤GFH¢I @P
float dx,dy;
void main()
{
clrscr();
printf(Enter delta Y : );
scanf(%f,dy);
printf(Enter delta X : );
scanf(%f,dx);
if(dy!=0) printf(Slope = %fn,dy/dx);
getch();
}
Enter delta Y : 3
Enter delta X : 4
Slope = 0.750000
Q5R2S T U
T V RV UWXU2YV
`5abcd e d ab
fg hi
-4-
 ¢¡ £ ¤¦¥¨§©¨©   ¦ ¥!$#¢%' ()101¤$32 ¥ 45 67$8 97
 ¢¡ £1¡   @A B @C%¤$§D E¢ E F E¢ ¥!$ ()101¤HGI ¥!IP B ¥ QR1S3T14 U 4R 1S  VW$C XY `37 a$bc32 ¥
dce f3e g$hig$pqe r¦s tu v¢w xy$€ qf¦‚ dg ƒ¦„c…3† v ‡ˆ ‰3ˆ $‘i$’qˆ “”
•¢– —1– ˜ ™d e'f¢g%g
if(condition)
statement_A;
else
statement_B;
h ™i1j
if(statement)
{
statement_A1;
statement_A2;
...
statement_An;
}
else
{
statement_B1;
statement_B2;
statement_Bn;
}
•¢– —1– k flmnpo¨qrf$s1t1u¦v$o¨™cw3x ou3o¨m yz { $| ‡
}c~ 3~ €$r€¦‚3~ ƒ¦„
…†$‚3‡$ˆ ~ ˆ †$‚
‰ ¦Š }c€
‹$Œ  €
Žc 3 ‘$’r‘¦“3 ”•
-5-
 ¢¡ £¤¡ ¥ ¦ § ¨¢©   !$# % ' )()01 2$0
3 4656798@ ¥ @A ¡ 4 B
#include stdio.h
#include conio.h
int choice;
float radius, circum, area;
void main()
{
clrscr();
textcolor(LIGHTRED);
cprintf(Menu);
printf(n);
textcolor(LIGHTGREEN);
cprintf(1.Circumference of the circle);
printf(n);
cprintf(2.Area of the circle);
printf(n);
printf(Enter your choice 1 or 2 : );
scanf(%d,choice);
printf(Enter radius of the circle : );
scanf(%f,radius);
if(choice==1)
{
circum = 2*3.14156*radius;
printf(Circumference of the circle =
%fn,circum);
}
else
{
area = 3.14156*radius*radius;
printf(Area of the circle = %fn,area);
}
getch();
}
-6-
  ¡£¢¥¤§¦©¨
Menu
1.Circumference of the circle
2.Area of the circle
Enter your choice 1 or 2 : 1
Enter radius of the circle : 3
Circumference of the circle = 18.84936
  ¡£¢¥¤§¦
Menu
1.Circumference of the circle
2.Area of the circle
Enter your choice 1 or 2 : 2
Enter radius of the circle : 3
Area of the circle = 28.274040
-7-
 ¢¡ £ ¤¦¥¨§©¨©   ¦ ¥!$#¢%' ()101¤$32 ¥ 45 67$8 97@4 5
 ¢¡ £A¡   BC D BE%¤$§F G¢ G H G¢ ¥!$ ()101¤I¥3¤¤$ P¥ RQS ¥!$ ()101¤IT3UV1#¦WXP (YX ¥!$ ()101¤
G1 !) H 0¦E1`¢aA G H #¦W%¤1WXP ¥!¦¤ b E
 ¢¡ £A¡ Q §c d'#¢%
#¢%% G H$  #¢%% G H3Q
if(condition_A)
statement_A
else if(condition_B)
statement_B
else if(condition_C)
statement_C
...
else if(condition_n)
statement_n
e ¥¢V1 e W 
f3g h¨f iqp r s t uwvqx y €‚ ƒ¦„… †‡qˆ ‰ ’‘3“ ” •%–— ˜ ™ dXe f g
if(condition_A)
{
statement_A
...
}
else if(condition_B)
{
statement_A
...
}
else if(condition_C)
{
statement_A
...
}
...
else if(condition_n)
{
statement_A
...
}
h¢i jAi k lm1noAp¨qrl$s1t1u¦v$p¨wXx3y pu3p¨nz|{¢u }~ €$ ‚€@} ~
ƒX„ …3„ †$‡r†¦ˆ3„ ‰¦Š
‹ …¦Œ ƒX†
$Ž  †
 ‘ ’ “ ”• ”‘ ’ – — ˜ ™ š › œ œ™ š ž Ÿ
 X¡ ¢3¡ £$¤r£¦¥3¡ ¦§
¨$© ª £
 X¡ ¢3¡ £$¤r£¦¥3¡ ¦$«
¬ ¢¦­  X£
-8-
 ¢¡ £¤¡ £ ¥ ¦ §¢¨©  !# $ % ('()0 1#)2% 
3 4656798@BAC@D ¡ 4E
#include stdio.h
#include conio.h
int point;
void main()
{
clrscr();
printf(Enter your's point :);
scanf(%d,point);
if( ( point = 100 )  ( point = 80 ) )
printf(Grade = An);
else if( ( point  80 )  ( point = 70 ) )
printf(Grade = Bn);
else if( ( point  70 )  ( point = 60 ) )
printf(Grade = Cn);
else if( ( point  60 )  ( point = 50 ) )
printf(Grade = Dn);
else if( ( point  50 )  ( point = 0 ) )
printf(Grade = Fn);
getch();
}
Enter your's point :99
Grade = A
-9-
 ¢¡ £ ¤¦¥¨§©¨©   ¦ ¥!$#¢%' ()101¤$32 ¥ 46587 9 @BA
 ¢¡ £$¡   §C D'#¢%
switch(variable)
case constant_A :
statement_A;
break;
case constant_B :
statement_B;
break;
...
case default :
statement;
break;
E   FHG¢I¦P QI ¦R¦S T UV1W X Y `¢a¢b%c d'cVW¦ef¢g h¢e i pq rs d t6uwvwv Y gyx i
€ b$e‚ t6W¦ƒ „ v%a¢…%… Q †3‡ dˆcV1W ‰B¢I¦P
‘ ’ “•”–1—3˜™ d$—B™ e¦fwgw”–1—3˜™ d$—B™ eh¦gˆi i i
jk1l j6m nBj1o3p q r s%tu¦vw vq1x¢y3z { t%z { | } d¦~ d ¦€$ ‚ ƒ n3z1j6m n¨„ˆl¢o
} d¦~ d ¦€$ ‚ w p¦m n3z { |j6m nBj1o3p q r… v‡†Bˆ%‰¨Š$z$‰6‹wŒ¦6p3Ž n
˜6™ dB™ ‚$‚$—3™ „ˆl¢o ”d3˜‚ t {‘ t ’
“ ”¢• –— ˜¨™3š› œ žŸ¢ 3¡ ¢ —¤£¦¥B¦¦¦¦§6¨ž¦©6ª ¥B©1«3¬ ž ­® ¦ ¯ °y±1¥¢Ÿ¦² ¢  
“ ³$• ´¦µ ›¢™¦¶ –· ¯ © ¢­— ¸§6°ˆ  ª¥ « ˜¨™3š› œ ¹º ­ £¦–° ¯ »B¼%¸¨½$¡$¸6¨°y± ¾ ££1¡1¦¢¥3¡¡$¥¨¸
¬3¿ ¥«3¥¨—Àˆ£¢« š6Á8 à ˜3Ä °'¥3¡¦®¢¨6ª –¨Å ª¨»B¼%¸¨½$¡$¸6¨w¦¦§¨œ ¼%¸ž1Ÿ¢Æ'œ ¬ž 1Ÿ¢Æ Ç3™¦µ ™ ¦´¦È ›
¡¢ Æ ˜É1Ê3š6à ™¦Ê3à ˢ 1®¢¼'œ ¸º ­ £Ÿ ’
“ Ì • ͦ›3Î ™$Ï¦È Ã °ˆ¥3¡ Ç¢™¦µ ™ ¦´¦È › ®¢¨6ª ²¸Ð«¦¡ ¢ Æ ˜É1Ê3š6à ™¦Ê3à –œ ±%ŸÑ»B¼%¸¨½$¡$¸6¨
¦$§6¬3¿ ¥«3¥¨—w²¥¨¨ š6à ™Bà ›$Ґ›$Ê3à Àˆ£¢« ͦ›3Î ™¦Ï¦È Ã
Ó¢Ô Ì Ô Õ ½Ö1—×w¥¨¹Ø½$Å11«¦¡$¥¨¸6¬3¿ ¥«3¥¨—Àˆ£¢« š6Á8 à ˜BÄ
Ù6Ú Û3Ú Ü$ÝØܦÞ3Ú ß¦à
á Û¦â Ù6Ü
ã$ä å Ü
æ ç è éç ê ëì1í
î ï ð ñ ò ó ð òô õ ö
ó ÷ øó ù úû1ü
î ï ð ñ ò ó ð òô ý
þ6ÿ  3ÿ ¡£¢¤¡¦¥3ÿ §©¨
£  ¡
 ¦¦! 
#   £$¤¦%
 ¦! #
-10-
 ¢¡ £¤¡ ¥ ¦§ ©¨¤!$#% '( )©021 345
#include stdio.h
char grade;
void main()
{
clrscr();
printf(Enter your grade : );
scanf(%c,grade);
switch(grade)
{
case 'a':
printf(point = 80-100n);
break;
case 'b':
printf(point = 70-79n);
break;
case 'c':
printf(point = 60-69n);
break;
case 'd':
printf(point = 50-59n);
break;
case 'f':
printf(point = 0-49n);
break;
default :
printf(unknown);
}
getch();
}
Enter your grade : a
point = 80-100
-11-
7KDQNRX
 ¢¡¤£¦¥§¡¤¨©£© ¡¤!
       #%$'%#
-12-
 ¢¡£¡¥¤¦¥§©¨ 

©  ¢! #©$%£')(£0¢132©054¥! 6 7 8 9©@ A BC£DEGF)H B FIDBPRQ S BC£TUBCUV¢BW£X3Y©`¥abdceUfIW g BhUCReIi)h S
pq p rs tIuv wu ¢xry5€ ‚ ƒ£„€ r … s uuvx s †x ‡ ˆ)‰3Rˆ)‰£‘t3t“’”‘¢•t£uv
pq – — ˜ˆ )‰©†™d…£ˆ— eˆ—†)ˆ)f©x ‡ ˆ)‰3Rˆ)‰3gˆ ”h u¢xry5€ ‚ ‘r 
pq h — ˜ˆ )‰©†™d…£ˆ— eˆ—†)ˆ)f©x ‡ ˆ)‰3Rˆ)‰3x ˜w ˆ5u i jG‘¢k3l um € u i jngˆ  u¢xry5€ ‚ v wu v w
pq ’ ‘ u j € — eˆx s †o k ƒ o p „ r‚ o q£‰3x ‚ ry js¥k¢ˆj ƒ£„€ x s †x ‡ ˆ)‰3Rˆ)‰
t©u V v¢w xb©fC£c)y£z¢X3W©z5PRF g BC£DE{X3Y©`¥ab x¥|v Q} )D Q S BC£TUBCUV¢BW3F)H B FIDBPRQ S BC£TUBC
ceUfIW g BhUCReIi)h S
–¢q p rs tI— eˆ—†)ˆ)f©x ‡ ˆ)‰3Rˆ)‰“xˆ)f ~  € 5‚ € ƒ ‚„ƒ …~ †~  ‡¢ƒ3ˆ€ ‰Š 5… ‹ Œ )Ž ©‹ Œ )£‘’ “” d• – )— ˜™Š ‰ †š ‰†… ƒ
ˆ€ ‰Š 5… ›œ5“ž™Ÿ’5”d  ¡¢¢)£ ¤ ¥ ¦ § ¨© ª« ¬5­3®¯ °
±)²„±±d±³”±)´„±µ”±¶„±)·¸³5²¸³³d³¹”³ºd´²
´´d´¶d´»¼¹ ´¼¹ º¸µ±™µ5¶d¶ ³¼¶·dº µ¼·¢³¼»±
³¢½ ³ ¾ ¿
ÀUÀUÀIÁ Á Á Á Á Á Á ÂUÂUÂ

More Related Content

การใช้ Turbo C ชุดที่ 6 condition

  • 1. -1-   ¡ ¢ £¥¤¦¨§© ! # $% ' $¥(! ) 0132 4)52 6 789A@¨BC D5E FBG HIB@ P H QR STU VW¨X`Y a bc de f ghiprqst¥u¥sv w5xry3€‚ƒ„ yr…r†ˆ‡ ‚‰ y ‘’ “ ” •—–˜ ™ d`e fg d – h i j5j`k`lm no ¨pq r`lh s tu5v w xy z5{`|z } ~`¥€ ‚ ƒ „…~€†‡5ˆ¥ ‰ Š ‹ Œ¨Ž—‘’ Š “ ”r• – — ˜¥™ š› œ ž Ÿ   ¡ ¢£ £ ¤ ¥ ¦ § ¨ © ª«¬ ­ ® ¯¨° ±² ³ ´ µ¶ · ¸`¹ º» ¼ ¸ ½ ¾ ¿À Á ¨ÃĨŠÆÇ È É Ê`ËrÌͨÎÏ¥Ð Ñ Ò Ó ÔÕ Ö¨Ë ×Ø × Ù Ú Û Ü Ý ÞߥÜà Ý á Û â ãä ¨å æçè ¥é èê ç ëìí¨îrïð5ð`ñ òäè ó ôõ ö ÷ ø`ùrúû¨üý¥þ ÿ   ¡£¢¥¤¥û ¦¨§ ©£ !£$#%' () $0 1 23 4 5 6876819$$7 @ A B C$DEF¨G$HPIPG8Q R ST UVG8W XY `aabc¨dPe f gh i pPqr sut v w w x y €$‚ƒ¨„$…P†P„8‡ ˆ ‰ ‘V„8’ “” •—–P˜ ™ – deefg¨hPi j kl m nPop qur s t t u r n$vwe¨x$yPhPx8z { |m }Vx8~ €£•£–P˜ ™ –€ deefg¨hPi j kl m nPop qur s t t u r n$vwe¨x$yPhPx8z { |m }Vx8~ ‚ ƒ…„† ‡Vˆ ‰ŠŠ‹Œ¨PŽ  ‘ ’ “P”• –u— ˜ ™ š› œužŸ ¡$¢u£¤¥§¦¨¨© ª¨ ¢¢« ¬­ ® ¯ ° ±² ³ ´ µ ¶· ¸ ¹ º» ¼½V¾£¿ À£¼$Á ¿ ¾¨ÃÄ¿ ÅÆ Ç¼ È$¾É ¾ ÊË $È$ÌÎÍ ÏÐVÑ » ¼$Ò Ó ÍÃÔ Ç¿ ÕÔ ÇÖ ×8Ñ » ¼$Ð ¶· ¶ Ø Ù Ú ÛÜ Ý$ÞPßáàà Ü âuãäPâuåÎæ$ççuâPèæVßVé æVÛ Ü Ý$çê ëæ8ì íVîï…ð8ñPòñPó ôõ ö ÷8ø ùú õû üýuþ õ ÿ¡  ò ¢ ô ö £ ù ¤¦¥¨§áõõ ù ©¨©Î÷¦©¨÷§ ÷ ¨÷ !¦ #¤8õ¡$%¦!£ ù ¤¦ þ #÷ ! íVîï…ð8ñ ò ñ ÿ ôõ ö ÷8ø ùú õû üýuþ õ ')( 01 23 54¡6¦70¡38 9@ A B CDE¨F G H)G I D¡C¦P%D¨F G P)G G QF¦QSR TF U¡V U A W X5U Y F 9@ ` a H)G bD¨G c5B deC¦G fa P)gh i5p qrs%tu vw yx€%yw%r‚ ƒ„ … † ‡ ˆ ‰  ‘’“¨‘”y•–— •¦˜¦™)™edf ‘¨‡  gih —• ‰¡j ‰ k l ˆ m ƒ„ k ’“¦‘¨”e•n op qr5n spr‰%m‘¡n jt•uh¦•‘¡n m‘v¨• w s• r5n m‘v¨• w mˆ • x¨mpxu‡%r•¦yn tlz… ™5–y–{ q | })~ €¦‚ƒ„y…‡† ˆ‰ Š ‹Œ )Ž¦‘’’¨‘ “ ¨” Œ •)–—¨’¨˜ •5™¨š › iœ%¦ž• Œ ’Ÿ—¨’ y‘ ¡¢ £ ‹Œ )Ž¡¦‘’’¨‘ “ –¤ ‘¦¥¦”)”e¦§ ’¨¨ Œ  ¡¢ © ‹Œ 5Ž¡¦‘’’¨‘ “ ™¡¦” ª5« ¬ ­5®%¯°¦±¨­ ² °¦³­´¨³ µ ¶ · ¸¹)º»¼ ½y¾¦¿¡À Á ÂÂÃÀ ÄÅ Ã)Æ Ç È É¦À Á Ê ËÌÆ¿¡ÍÎ)Á ÏɨÁ СÑ5ҦнÓÄ¦Ê Ô5Ò¦ÁÇ ÕÖ Ä¦ÆÊ ×eÒ¦Á ÇÍ Ø)ÙÌ È ØyÚ ÛÜÝ Þß à5áâ Ý ãä åæç éè êë ì å à í¡î ïðñóò¦ôõ¨ö ÷ø¦ò¦ö õ¡ùúö ò û úü ý¡þ ÿ ¢¡ ÿ£ ¤ ÿ ¢¡¦¥¨§ © ¨ !¨ # $ % %¦!¨ #$ % % '')( 0¨1)2 3 ( 4¨5¢( !6% 780 '92 !¨4¨
  • 2. -2-  ¢¡¤£¦¥¨§© ¢¢ ¡¨ ¢££¦ !#%$' ( )0 12 43¨5'6 7'8@9ACBD ECF GIHA'PQG'R PQS9QP'T U V'W XY ¢` a b cd¢efg hpi4q¨rts uCvCrtwx y€ ‚ ƒ „Q…¨† ‡ ˆ ‰‘¦‰ ’“Q”'•—–Q˜• ™ d—e f¢g—e‘“4h¢’“Q”%ei j4kjQlm¨nonqp rs¤t¤uvw j x yz { |} #~€ ' ~ |} #~€ '‚| } ~ ƒ%„†… ‡ ˆC‰ Š ‹ Œ¢Ž¨#¨‘@4’ “#”•¤–#”‘¨——˜¤‘q‘™ š›—œoŒo”Q  ž¨Ÿ ž  ¡¢Q£¤¢%¥p¦¢§%¨© ª «#¬­¤®¨¯¨°%± ²³ ´Cµ—´Q¶—· ¸ ¹pº »¼ ½ ¾¿À Á ¾Â Á ÃÄ Å ÆÇ—È ÉÊËÌ ÍqÎ ÏÐ Ñ Ç¢Æ¤Ò¨ÃpÓ Ô Ñ Ë ÕÖ Q×#ÆpØ Ù¨Ú Ù¨Ú Ù Û ÜÝ Þ ß¢à¤á¨âpã'à—äCåoæQçèæ%éߢêCë¢ë¢ì Û åíàoèêQæ Û åoæî¤ï¨ð Û ñ î¤ï¨ðóò#æݤߤèêQæ'ô õê Û àö¨àoèêQæ ÷ø4ù¨ú—û%û4ü¤ý—øþ¤ú—û ÿ   ¡ ¢ £¥¤ ¦¨§©© ! $# %' (0)132 46587 9¥@ ACB ACB D E8FHG¥IQPSR$I T UQV W8XQVYFH`!aCRRcb de3f3E!V'g FhaCRHi `!fQf3Eb pq!r s tu¥vSw xy€‚3ƒ „¨…S† ‡ˆ „ ‰C† ‡ˆ $0‘!’ “¥‘ ” •C– —˜ $™0d!e f¥dg— ˜ ” h!– f¨ij— k l'm nCo p q8rSs¥tQuSv$t w xQy z8{QyYrH|!}Cvvc~ €33q!y'‚ r —˜ nCo p3o n ƒ¥„ … ƒ¥†‡!ˆH‰ ŠC‹ Š Œ ŠC‹YŽH! ‘’3“3‡“Q” • –  —Š 3”''˜0†™ Œ '‹YŽH! ‘’3“3‡›š’3“œ‹' Žj˜0ˆ’3“CžC¨– ‹' Ž ŸC  ¡3  ¡ ˆ• ¢c£C¤¤ if (condition) statement; ¥ ¦H§3¨'©3ª « ª §3¨ ¬­Q®°¯ ±­ ² ®8³3´Cµ¶ · ² ¸¥¹ º¨»¼¼ ½ ¾¿ À¯ ÁÂ!³ Ã$Ä Å'Æ ¹0Ç­3® È6É!Ê Ë¥Æ Ì Í¨Î Ï6Î Ð!ÑÒÐ!Ó'Î ÔÕQÖ × Ø¨ÙQÚ3Û8×QÜ!Ý'Þ ß à Þ'á âÒ× Ø âCã Ýä à Ù8å3æCç0ã èé!å ê$ë ì'í î × Ø âSïß8× Ø¨ÙQÚ3Û8×QÜ!Ý'ïQâ'ðQð!ñ òâ Só0åô àÝ hõ8ö¥÷ بÙCÝ!ÙQÚ ø òù ¥åð!úSÙ8û ü0ýCþ'ÿHþ¡  ¢£¥¤§¦¨§©©¡ þ if (condition) { statement_1; statement_2; ... statement_n; }
  • 3. -3-  ¢¡ £¤¡ ¥ ¦¨§¤©¨ ! $#©  ¢¡ £¤¡ % ' (¢)¨0 1 $#2 354 6 78 9 @BABCED$F¤GFH¢I @P float dx,dy; void main() { clrscr(); printf(Enter delta Y : ); scanf(%f,dy); printf(Enter delta X : ); scanf(%f,dx); if(dy!=0) printf(Slope = %fn,dy/dx); getch(); } Enter delta Y : 3 Enter delta X : 4 Slope = 0.750000 Q5R2S T U T V RV UWXU2YV `5abcd e d ab fg hi
  • 4. -4-  ¢¡ £ ¤¦¥¨§©¨© ¦ ¥!$#¢%' ()101¤$32 ¥ 45 67$8 97  ¢¡ £1¡   @A B @C%¤$§D E¢ E F E¢ ¥!$ ()101¤HGI ¥!IP B ¥ QR1S3T14 U 4R 1S VW$C XY `37 a$bc32 ¥ dce f3e g$hig$pqe r¦s tu v¢w xy$€ qf¦‚ dg ƒ¦„c…3† v ‡ˆ ‰3ˆ $‘i$’qˆ “” •¢– —1– ˜ ™d e'f¢g%g if(condition) statement_A; else statement_B; h ™i1j if(statement) { statement_A1; statement_A2; ... statement_An; } else { statement_B1; statement_B2; statement_Bn; } •¢– —1– k flmnpo¨qrf$s1t1u¦v$o¨™cw3x ou3o¨m yz { $| ‡ }c~ 3~ €$r€¦‚3~ ƒ¦„ …†$‚3‡$ˆ ~ ˆ †$‚ ‰ ¦Š }c€ ‹$Œ  € Žc 3 ‘$’r‘¦“3 ”•
  • 5. -5-  ¢¡ £¤¡ ¥ ¦ § ¨¢© !$# % ' )()01 2$0 3 4656798@ ¥ @A ¡ 4 B #include stdio.h #include conio.h int choice; float radius, circum, area; void main() { clrscr(); textcolor(LIGHTRED); cprintf(Menu); printf(n); textcolor(LIGHTGREEN); cprintf(1.Circumference of the circle); printf(n); cprintf(2.Area of the circle); printf(n); printf(Enter your choice 1 or 2 : ); scanf(%d,choice); printf(Enter radius of the circle : ); scanf(%f,radius); if(choice==1) { circum = 2*3.14156*radius; printf(Circumference of the circle = %fn,circum); } else { area = 3.14156*radius*radius; printf(Area of the circle = %fn,area); } getch(); }
  • 6. -6-   ¡£¢¥¤§¦©¨ Menu 1.Circumference of the circle 2.Area of the circle Enter your choice 1 or 2 : 1 Enter radius of the circle : 3 Circumference of the circle = 18.84936   ¡£¢¥¤§¦ Menu 1.Circumference of the circle 2.Area of the circle Enter your choice 1 or 2 : 2 Enter radius of the circle : 3 Area of the circle = 28.274040
  • 7. -7-  ¢¡ £ ¤¦¥¨§©¨© ¦ ¥!$#¢%' ()101¤$32 ¥ 45 67$8 97@4 5  ¢¡ £A¡   BC D BE%¤$§F G¢ G H G¢ ¥!$ ()101¤I¥3¤¤$ P¥ RQS ¥!$ ()101¤IT3UV1#¦WXP (YX ¥!$ ()101¤ G1 !) H 0¦E1`¢aA G H #¦W%¤1WXP ¥!¦¤ b E  ¢¡ £A¡ Q §c d'#¢% #¢%% G H$  #¢%% G H3Q if(condition_A) statement_A else if(condition_B) statement_B else if(condition_C) statement_C ... else if(condition_n) statement_n e ¥¢V1 e W f3g h¨f iqp r s t uwvqx y €‚ ƒ¦„… †‡qˆ ‰ ’‘3“ ” •%–— ˜ ™ dXe f g if(condition_A) { statement_A ... } else if(condition_B) { statement_A ... } else if(condition_C) { statement_A ... } ... else if(condition_n) { statement_A ... } h¢i jAi k lm1noAp¨qrl$s1t1u¦v$p¨wXx3y pu3p¨nz|{¢u }~ €$ ‚€@} ~ ƒX„ …3„ †$‡r†¦ˆ3„ ‰¦Š ‹ …¦Œ ƒX† $Ž  †  ‘ ’ “ ”• ”‘ ’ – — ˜ ™ š › œ œ™ š ž Ÿ  X¡ ¢3¡ £$¤r£¦¥3¡ ¦§ ¨$© ª £  X¡ ¢3¡ £$¤r£¦¥3¡ ¦$« ¬ ¢¦­  X£
  • 8. -8-  ¢¡ £¤¡ £ ¥ ¦ §¢¨© !# $ % ('()0 1#)2% 3 4656798@BAC@D ¡ 4E #include stdio.h #include conio.h int point; void main() { clrscr(); printf(Enter your's point :); scanf(%d,point); if( ( point = 100 ) ( point = 80 ) ) printf(Grade = An); else if( ( point 80 ) ( point = 70 ) ) printf(Grade = Bn); else if( ( point 70 ) ( point = 60 ) ) printf(Grade = Cn); else if( ( point 60 ) ( point = 50 ) ) printf(Grade = Dn); else if( ( point 50 ) ( point = 0 ) ) printf(Grade = Fn); getch(); } Enter your's point :99 Grade = A
  • 9. -9-  ¢¡ £ ¤¦¥¨§©¨© ¦ ¥!$#¢%' ()101¤$32 ¥ 46587 9 @BA  ¢¡ £$¡   §C D'#¢% switch(variable) case constant_A : statement_A; break; case constant_B : statement_B; break; ... case default : statement; break; E   FHG¢I¦P QI ¦R¦S T UV1W X Y `¢a¢b%c d'cVW¦ef¢g h¢e i pq rs d t6uwvwv Y gyx i € b$e‚ t6W¦ƒ „ v%a¢…%… Q †3‡ dˆcV1W ‰B¢I¦P ‘ ’ “•”–1—3˜™ d$—B™ e¦fwgw”–1—3˜™ d$—B™ eh¦gˆi i i jk1l j6m nBj1o3p q r s%tu¦vw vq1x¢y3z { t%z { | } d¦~ d ¦€$ ‚ ƒ n3z1j6m n¨„ˆl¢o } d¦~ d ¦€$ ‚ w p¦m n3z { |j6m nBj1o3p q r… v‡†Bˆ%‰¨Š$z$‰6‹wŒ¦6p3Ž n ˜6™ dB™ ‚$‚$—3™ „ˆl¢o ”d3˜‚ t {‘ t ’ “ ”¢• –— ˜¨™3š› œ žŸ¢ 3¡ ¢ —¤£¦¥B¦¦¦¦§6¨ž¦©6ª ¥B©1«3¬ ž ­® ¦ ¯ °y±1¥¢Ÿ¦² ¢   “ ³$• ´¦µ ›¢™¦¶ –· ¯ © ¢­— ¸§6°ˆ  ª¥ « ˜¨™3š› œ ¹º ­ £¦–° ¯ »B¼%¸¨½$¡$¸6¨°y± ¾ ££1¡1¦¢¥3¡¡$¥¨¸ ¬3¿ ¥«3¥¨—Àˆ£¢« š6Á8 à ˜3Ä °'¥3¡¦®¢¨6ª –¨Å ª¨»B¼%¸¨½$¡$¸6¨w¦¦§¨œ ¼%¸ž1Ÿ¢Æ'œ ¬ž 1Ÿ¢Æ Ç3™¦µ ™ ¦´¦È › ¡¢ Æ ˜É1Ê3š6à ™¦Ê3à ˢ 1®¢¼'œ ¸º ­ £Ÿ ’ “ Ì • ͦ›3Î ™$Ï¦È Ã °ˆ¥3¡ Ç¢™¦µ ™ ¦´¦È › ®¢¨6ª ²¸Ð«¦¡ ¢ Æ ˜É1Ê3š6à ™¦Ê3à –œ ±%ŸÑ»B¼%¸¨½$¡$¸6¨ ¦$§6¬3¿ ¥«3¥¨—w²¥¨¨ š6à ™Bà ›$Ґ›$Ê3à Àˆ£¢« ͦ›3Î ™¦Ï¦È Ã Ó¢Ô Ì Ô Õ ½Ö1—×w¥¨¹Ø½$Å11«¦¡$¥¨¸6¬3¿ ¥«3¥¨—Àˆ£¢« š6Á8 à ˜BÄ Ù6Ú Û3Ú Ü$ÝØܦÞ3Ú ß¦à á Û¦â Ù6Ü ã$ä å Ü æ ç è éç ê ëì1í î ï ð ñ ò ó ð òô õ ö ó ÷ øó ù úû1ü î ï ð ñ ò ó ð òô ý þ6ÿ  3ÿ ¡£¢¤¡¦¥3ÿ §©¨ £ ¡ ¦¦! # £$¤¦% ¦! #
  • 10. -10-  ¢¡ £¤¡ ¥ ¦§ ©¨¤!$#% '( )©021 345 #include stdio.h char grade; void main() { clrscr(); printf(Enter your grade : ); scanf(%c,grade); switch(grade) { case 'a': printf(point = 80-100n); break; case 'b': printf(point = 70-79n); break; case 'c': printf(point = 60-69n); break; case 'd': printf(point = 50-59n); break; case 'f': printf(point = 0-49n); break; default : printf(unknown); } getch(); } Enter your grade : a point = 80-100
  • 12. -12-  ¢¡£¡¥¤¦¥§©¨ © ¢! #©$%£')(£0¢132©054¥! 6 7 8 9©@ A BC£DEGF)H B FIDBPRQ S BC£TUBCUV¢BW£X3Y©`¥abdceUfIW g BhUCReIi)h S pq p rs tIuv wu ¢xry5€ ‚ ƒ£„€ r … s uuvx s †x ‡ ˆ)‰3Rˆ)‰£‘t3t“’”‘¢•t£uv pq – — ˜ˆ )‰©†™d…£ˆ— eˆ—†)ˆ)f©x ‡ ˆ)‰3Rˆ)‰3gˆ ”h u¢xry5€ ‚ ‘r  pq h — ˜ˆ )‰©†™d…£ˆ— eˆ—†)ˆ)f©x ‡ ˆ)‰3Rˆ)‰3x ˜w ˆ5u i jG‘¢k3l um € u i jngˆ  u¢xry5€ ‚ v wu v w pq ’ ‘ u j € — eˆx s †o k ƒ o p „ r‚ o q£‰3x ‚ ry js¥k¢ˆj ƒ£„€ x s †x ‡ ˆ)‰3Rˆ)‰ t©u V v¢w xb©fC£c)y£z¢X3W©z5PRF g BC£DE{X3Y©`¥ab x¥|v Q} )D Q S BC£TUBCUV¢BW3F)H B FIDBPRQ S BC£TUBC ceUfIW g BhUCReIi)h S –¢q p rs tI— eˆ—†)ˆ)f©x ‡ ˆ)‰3Rˆ)‰“xˆ)f ~  € 5‚ € ƒ ‚„ƒ …~ †~  ‡¢ƒ3ˆ€ ‰Š 5… ‹ Œ )Ž ©‹ Œ )£‘’ “” d• – )— ˜™Š ‰ †š ‰†… ƒ ˆ€ ‰Š 5… ›œ5“ž™Ÿ’5”d  ¡¢¢)£ ¤ ¥ ¦ § ¨© ª« ¬5­3®¯ ° ±)²„±±d±³”±)´„±µ”±¶„±)·¸³5²¸³³d³¹”³ºd´² ´´d´¶d´»¼¹ ´¼¹ º¸µ±™µ5¶d¶ ³¼¶·dº µ¼·¢³¼»± ³¢½ ³ ¾ ¿ ÀUÀUÀIÁ Á Á Á Á Á Á ÂUÂUÂ