ݺߣ

ݺߣ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• – —
˜¥™ š› œ ž Ÿ
  ¡ ¢£ £
¤ ¥
¦ § ¨ © ª«¬ ­ ®
¯¨° ±²
³ ´ µ¶ · ¸`¹ º» ¼ ¸ ½ ¾¿ ÀÁÂà ĥÅÆÇÁÆ5È ¾¥¿À ÀÉ Ê5Ë Ì ÍÎ Ï Æ
ÐÑ Ò Ó Ô`ÕrÖרØÙ¥Ú Û Ü Ý Þß à¨Õ
áâ á ã ä å æç èé—ê ë ì ì¥æíã äîï¨ðñò5íóì¥í ô`ã õö ÷ øì¥æíóùú û¥üê
ýþ ÿ ã ä å æç èé—ê ë ì ì¥æíã äîï¨ðñò5íóì¥í ô`ã õö ÷ øì¥æí íë  5ä å øô
¡
ê
¢¤£ ¥ ¦§ ©¨ ! ©#%$ (' )021©3245 67¤1¤8 9©@ABC DE F G HI P Q RTSRTGU@S
V W X Y`ab(cdecTfTghi2pq¤r2i s td uv wx y €  ‚ ƒ„¤„…†(‡ˆ ‰ 2‘ ’ “”• –—
˜™ ˜ “de „(fg ‡ fTh i‰ ¤j kl mno pqrms(t uTt vt w o©xlTuTmyz2q{¤s
|} ~ €‚(ƒ„…ƒT† †‡ ‚(ˆ ‰ Š ‹ Œ2 ‰ Ž„   ‘’“ ” •
–— ˜ ™ š ›œ ž Ÿ¡¢ £ ¤
¥¦(§ ›œ ž Ÿ£ ¤
¨© ª «¬­®(¯°±² ®(³ ´ «µ ¶ ·2¸ ´ ¹° º»¼ ½ ¾ ¿
ÀÁ ÂÃÄŤƤÇÈɤÊ2ËÍÌ(Î2ÏÆÃ2Ð(ƤÈÈÑ
Ò¤Ó Ô Õ Ö
Ò¤Ó × Õ Ö
Ø¤Ù Ú Û ÜÝ Þß à©á â©Þãä á à(åæá çè éÞ 2êàë à ìí êîðï ñò ó Ý Þô õ ï2åö éá ÷ö éø ùTó Ý Þò
Ø¤Ù Ø ú û ü ý þ ÿ¡ £¢¥¤¦¤ þ §©¨£§©¡©§£¢  ý þ ÿ¡ ! #£$ $%¡¡%¡'¡(#£$ $%¡¡%£) 021 3 45 67 128 9@©A 1
B¦C ) D 0 3 E 6 F¡G£H¥1¦1 6 I©PQ£I©R4¡SS©I£T4HU 4VW4X¡Y `F1¦a2S¡XbE 6 F¡S A `4X #£$ $%¡¡%¡ 0c1 3 45 67 128 9@©A 1
dWe fg h icp¦q¡r©f¦is
t©u v w x©y€£‚ ƒW‚„ y¦x¡…2y£‚ …W‚ ‚†b¡†ˆ‡ ‰ ¦‘ v v ’c “ 
t©u ” •ƒW‚–©y£‚ —cw ˜™x¡‚ d •…Wef
t©u g h i ‘bx† jk•ƒW‚–©y£‚ —l¦mefˆ‡ ‰ ¦‘ npoqWrs©t£r u
vcw xbybz2{| } ~€2~2y‚
ƒ„ … † ‡ ˆ ‰ Š ‹©Œ£‹©Ž‘ ¡’¡“W“¥”• ‹£‡ Š –˜— ‘ ‰¦™‰š…™› ˆ œ
ƒ„  Œ¡‹£Ž¥bž Ÿ  ¡¢ cž £ b¢‰2œ©‹¦ž ™b¤©¥—¡b‹¦ž œ©‹¦£§ £¢cž œ©‹¦£§œ ˆ ¨£œ b¨¥‡2¢¡©©ž ¤©›š…
“c ª ¡ « ’£¤W¬ “c ª ¡b­
®W¯ °±¡²b³´µ¶¸·
¹º » ¼½ ¾W¿À©Á¡ÂbÃãÂÄ Á£¾Å ½ ÆWÇ È£Ã£É ÆcÊ£Ë Ì ¾˜Í2ΡÏÆ ½ éÐȣéÑÂ
ÒÓ Ô ¼½ ¾W¿¦ÀÁ¡ÂbÃãÂÄ ÇÕ Â¡Ö¡ÅWÅ¥×Ø Ã£Ù ½ ¾
ÒÓ Ú ¼½ ¾c¿¦ÀÁ¡ÂbÃãÂÄ Ê¦Î¡Å
ÛcÜ Ý Þcß2à©á¡â£Þ ã á¡ä©Þå£ä
æ çè éêWëìí îï¡ð¦ñò ó©ó©ô©ñõö ôW÷ ø ù ú¡ñ òû üý©÷bð¦þÿWò¡ ©ú£ò ¢¤£¦¥§¢î ¨bõ¡û ©¦¥¡ò ø   õ¡÷©û ¥¡ò ø þ ý ù
 !# $% ¦'
(
 )10 234 65 7 8@9 2  A¤B C1D#EGF§H@IQP R@S§F§P I¤TU@P F
V U@W X¤Y `a§b `c de`a§bf@g h i¡p¤i@qsr t u1v w@x x y1€  w@x x y¤€   ‚ƒ‚ƒ‚…„ †@‡…ˆ x ‰ „ @‘§„ x w ’† ‚ƒ‚“ˆ x w@@‚
-2-
 ¢¡¤£¦¥¨§© ¢¢ ¡¨ ¢££¦ 
!# $ % ')(10¢234576 8¢9@BA¨C)DBDEGF¤H I PQ R 9
SBTVUW1XY `1a bdcWBefbBg efhUfeBi
a pBg qr ¢s t u vw¢xy€ ƒ‚)„¨…G† ‡1ˆ1…G‰ ‘“’ ”
•–—B˜™ —1dfe¢g h ij˜k1dml n1™ op™ kB—foBq —f–˜f—B•
rs Gt)u v w
xydx z¨{)|1}¢~€7‚
xƒdx z¨{)|B„ …f†¤„B‡ ˆƒ{)€‰ Š|‹ Œ w €)„ …f†¤„B‡
x7#x z¨{)|B|sGŽ¤u v w †  ‚
y  z{)|1}¢~€7‚
y¨ y ‘’“” • – —G˜ ™¨š › œ ž
Ÿ¨  Ÿ¨  Ÿ ¡¢ £7¤1¥¤¥
printf(control string,variable list);
¦ control string §¨1©“ª « ¬)© « ­1®ƒ¯ °± ² ©f§¬G³G´¨°
¯ µ « ¶1§¬G·§ ¸´ ¯¹ ºj»)·¢·°1µ¤¯¨1©© « ­f±¨¯G¼
§1¬ ·¢§ ¸´ ¯¹ ºj»)·¢·¤­f³G¯G»1¶1½¾f¿¨À
¡BÁ Â)ÃÄÅ)¥jÄ ÆÇ ¤¡¢ £7¤1¥¤¥
È Ä¡É Ê ËÌ ÁƒÇ¤ÍΠĢÅ)Í)ǤÁƒÇ¤ÍÎ
ÏÐ
ÏÑ
ÏÒ
ÏÓ
ÏÔ
ÏÖÕ
ÏØ×
ÙÚ
ÙØÛ
ÙÖÙ
Ü Ý Þ)ß Ý àfá¨âGã
ä å1á¢æ çè Gé¨ÞGé¤ä Üê ë
ä åfáì é¨âí îjï)ð¢ðjä ß1àfñ òó õôä é¨é¤ä ö÷1øfå
ä å1á¢ùƒúéû1øBë
ü ýfþ¢ÿ¡ £¢¥¤¡¦¨§
©¡ 
ü ýfþ  ! £# $£#¥% ' ()( 01 2¡3¨% 145 6 7¡8@9 (¡A
% BCED¡£#¨F2G 9IH
P 7 A# Q %  7 4Q
R
-3-
  ¡£¢ ¢¥¤§¦§¤©¨§ ¢
#include stdio.h
int x1 = 49, x2 = 0xF7, x3 = 0123;
float y1 = -123.456, y2 = 1.23e04;
char z = 'A';
char name[12] = rajamakala;
main()
{
clrscr();
printf(x1 = %d n, x1);
printf(x2 = %x x2 = %X x3 = %o n, x2, x2, x3)
printf(y1 = %f y2 = %e n, y1, y2);
printf(z = %c name = %s n, z, name);
}
x1 = 49
x2 = f7 x2 = F7 x3 = 123
y1 = -123.456001 y2 = 1.23000e+0
z = A name = rajamakala
    §©!#§$%! ' () 0213$($2 4 5§6879¥@2A B3C%D2E#FGH©I
P Q R SUT VW X(Y`3a
SUT Vcb d e` f a V g`£a Q R
h i£p p¥q§r§q£s T pt
#include stdio.h
float x1 = 12.345, x2 = 1.234e+0
void main()
{
clrscr();
printf(%.4f n, x1);
printf(%.1f n, x1);
printf(%.2e n, x2);
printf(%.1e n, x2);
}
12.345
12.3
1.2e+0
1e+05
-4-
 ¢¡ £¢¡ ¤ ¥§¦ ¨©  ¥! $#% $©  '¦(¥¨) 0 1 2¢'
3 45 6)7%8%9@§A B CEDF)5)GHI5)@8 PF)QSR§T 5)U9 B V9WX Y B %m.ns V§9IW `
abEcd ef )g¢h)g ci pEq¢r)s(tu vwx cypEf)r €  x ‚%ƒ%„y…‚%†Is ‡ ˆ‰E…‘ ‰’ “I”• –§”• –— ˜ ™ d%e%fgEh¢i
j kmlnpo qr s§tu)v w x y x zE{|)u)}~€y z€ x u)‚¢ƒ x u„
… †E‡ ‡)ˆ‰ˆŠ‹ ‡§Œ
#include stdio.h
char message[] = Education
void main()
{
clrscr();
printf(%.8sXn, message);
printf(%12.7sXn, message)
printf(%-12.6sXn, message
}
EducatioX
EducatiX
Educat X
¢Ž ¢Ž  ‘’“¢”•–)—˜™— š› $“¢œ•%IžŸ ¡$¢ £ ¤I¥I¦ ¦ § ¥¨¢©ª¤I«¬­ ¦ «® ¯
° ± ²³ ´ µ
¶·¸¢¹º»)¼½¾¼ ¿À ¼I½ÁÀ Â(À ÁÃ
Ä Å
Ä Æ
Ä Ç
Ä È
Ä É
Ä Ê
ËÌ Í Î¢ÏIÐ Ð Ñ Ò ÓÔ Õ Ö ×
Ø ÙÚ Î¢Û ×Ü ÝEØ Ù ×Þ)ÝàßâáEÑ ã ä
å æç èé ê¢ëìíî ê¢ïIð ð ñ ò ó
ôõ ö ê¢÷ ê ø ù)ú ÷ û ü
ý%é%þÿæ ò ïIëìI÷ êõ è Eé ò ÿEô¢ð¢¡
£¥¤¥¤§¦
-5-
  ¡£¢ ¢¥¤§¦§¤©¨ ¢
#include stdio.h
void main()
{
printf(“ComputertProgrammingn”);
printf(“C Language”);
printf(“bbbbProgramminga”);
}
Computer Programming
C LangProgramming
    ©!£  §#%$')(   01#%$2 3 4  §#%!5¥67§!1084 93 @7A  B C D EFG FH IP Q R
S TU V'W§X8X
Y`a `b cd e f a%b g9e f a'c h
i pq9r s t uv§wx9y1€  ‚ w ƒ „… †‡ ˆ ‰  ‘ t x9y§’ ƒ t “7y§’ ƒ t €” † y§w•©u
– t uv§w)—1˜§™„ … †‡ ˆ ‰  ‘ t x9y§’ ƒ t “7y§’ ƒ t €” † y§w•©u
de fe g h i§j1k8l m9n o7p1q%rs tn 1uv§hw'j§x ym%z {¥| }
putchar()
~ € '‚§ƒ8ƒ
putchar(char)
„ …£† †¥‡§ˆ§‡£‰1Š †‹
#include stdio.h
char c = 'F';
void main()
{
putchar(c);
gotoxy(3,2);
putchar('a');
}
Fa
-6-
 ¢¡ £¥¤§¦§¨ ©¨§   ¥  ¢ £¢!¤$#¥%  ¦' ( ¥#$¨ ©¨§
) 01 132$4$2$5¥6 187
#include stdio.h
main()
{
int a
fprintf(stdprn,C programmingn);
a = 20;
fprintf(stdprn,a = %dn,a);
}
9 6 @A3B BC DE F G$H I P
9 6 Q @A3B BC DE F G$H I P¥R F S$T
scanf()
U BI VXW$DD
scanf(control,variable1, variable2,
Y control `a
GbE F G
`
S3A3HcWdPe fB
a
G$B f C g
`
S3D
` h
H¥BI VXW$DD
i f H
a
G$p @C D
printf()
Y variable `a
GqWdGR i R¥B gEG$r§s C S$W$VB
U f A8@¥t IF u v F Vw§G$p¢E F G$H I Pdx§H ys¥B r$@ C Dv¢p€$R¥EG$r§s C S$W$VB
 e ‚8ƒ A3u f F i @€$R „ …†§‡ ˆ‰ ‘’„ „ “d„
-7-
  ¡£¢ ¢¥¤§¦§¤§¦©¨ ¢
#include stdio.h
int age,day,month,year;
char name[15], surname[30];
void main()
{
clrscr();
printf(Insert age : );
scanf(%d,age);
printf(You are %d years old.n,age);
getch();
clrscr();
printf(Insert birthdate dd,mm,yyyy :);
scanf(%d %d %d,day,month,year);
printf(Your birthdate is %d/%d/%dn,day,month,year);
getch();
clrscr();
printf(Insert name surname :);
scanf(%s %s,name,surname);
printf(Hi %s %sn,name,surname);
getch();
}
Insert age : 17
You are 17 years old.
Insert birthdate dd,mm,yyyy :10 11 12
Your birthdate is 10/11/12
Insert name surname :abc def
Hi abc def
-8-
 ¢¡ £ ¤¦¥¨§¨§©  ¦  © ¤!§ $#¢¦¨%¦'§(0) ¤ 1
 ¢¡ £¡ 2 ¤¥ §¨§©  ¦  435¦6© ¤!§ 7  8¦9
getchar()
@ AB CD E F GH I¦PQ0I¢R FB S0DAR TU E F V¨WQ4X Y` ab cV0F B S0DAR U¦dGe E f X WQ4X Y g h¨i p0q
r st u vwx y€ u4‚4ƒ¦„6…¢†¢‡¦s
r w€ ˆ! …¢…
variable = getchar();
‰¢ ‘ ‘ ’¦“ ”¨”•–— ˜ ™¦d e f4ghf¦i6™• ’—!” ij ˜ k¦l
getch()
r wt …v m s n€ o¦pq0o¢x st u0vwx rsq4t uv †w x„0s t u0vwx!y¨n z{m s „¨{¦|nƒ m } t sq4t u g h¨i p0q
r st u vwx y¨n zy€ u4‚4ƒ¦„6…¢†¢‡¦s
r w€ ˆ! …¢…
variable = getch();
~¦ €4 ~ u | w wt …¢v m s n€ opq x‚ ˆƒ0†v m s0s¦}|nƒ m } t gets()
r w€ ˆ! …¢…
gets(str)
r str s„0s…{ t }  ˆ¢w ††‡ ƒ¢‚4{¦w‡¨„ u u4pq xˆ † m ‚ u‰ …¢v m s n€ o
-9-
  ¡£¢ ¢¥¤§¦§¤§¨© ¢
#include stdio.h
char grade;
char name[15];
void main()
{
clrscr();
printf(Name : );
gets(name);
printf(Hi %sn,name);
getch();
clrscr();
printf(Grade : );
grade = getchar();
printf(Programming Language grade = %c.n,grade);
getch();
clrscr();
printf(Grade : );
grade = getch();
printf(nProgramming Language grade = %c.n,grade);
getch();
}
Name : asdf
Hi asdf
Grade : A
Programming Language grade = A
Grade :
Programming Language grade = B
-10-
7KDQNRX
 ¢¡¤£¦¥§¡¤¨©£© ¡¤!
       #%$'%#      
(0)1)%23%4¢5 687
9A@
-11-
 ¢¡ £¥¤¢¦ §¨©¥! #¦ $%  '¢( )#0 123 ( 4¢¦ 5!§6879@!©¥ A¢BC 5 D 4EF20 12
 ¢¡   G5! 4
 ¢¡ H G593 12¤
 ¢¡ I G590 P Q
 ¢¡ R G5!EF2
 ¢¡ S ¦ 7TU£¢2¥92 EF2
 ¢¡ V W XY¢` abc d e
f8f8f#g g g g g g g h8h8h

More Related Content

การใช้ Turbo C ชุดที่ 5 IO

  • 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• – — ˜¥™ š› œ ž Ÿ   ¡ ¢£ £ ¤ ¥ ¦ § ¨ © ª«¬ ­ ® ¯¨° ±² ³ ´ µ¶ · ¸`¹ º» ¼ ¸ ½ ¾¿ ÀÁÂà ĥÅÆÇÁÆ5È ¾¥¿À ÀÉ Ê5Ë Ì ÍÎ Ï Æ ÐÑ Ò Ó Ô`ÕrÖרØÙ¥Ú Û Ü Ý Þß à¨Õ áâ á ã ä å æç èé—ê ë ì ì¥æíã äîï¨ðñò5íóì¥í ô`ã õö ÷ øì¥æíóùú û¥üê ýþ ÿ ã ä å æç èé—ê ë ì ì¥æíã äîï¨ðñò5íóì¥í ô`ã õö ÷ øì¥æí íë  5ä å øô ¡ ê ¢¤£ ¥ ¦§ ©¨ ! ©#%$ (' )021©3245 67¤1¤8 9©@ABC DE F G HI P Q RTSRTGU@S V W X Y`ab(cdecTfTghi2pq¤r2i s td uv wx y €  ‚ ƒ„¤„…†(‡ˆ ‰ 2‘ ’ “”• –— ˜™ ˜ “de „(fg ‡ fTh i‰ ¤j kl mno pqrms(t uTt vt w o©xlTuTmyz2q{¤s |} ~ €‚(ƒ„…ƒT† †‡ ‚(ˆ ‰ Š ‹ Œ2 ‰ Ž„   ‘’“ ” • –— ˜ ™ š ›œ ž Ÿ¡¢ £ ¤ ¥¦(§ ›œ ž Ÿ£ ¤ ¨© ª «¬­®(¯°±² ®(³ ´ «µ ¶ ·2¸ ´ ¹° º»¼ ½ ¾ ¿ ÀÁ ÂÃÄŤƤÇÈɤÊ2ËÍÌ(Î2ÏÆÃ2Ð(ƤÈÈÑ Ò¤Ó Ô Õ Ö Ò¤Ó × Õ Ö Ø¤Ù Ú Û ÜÝ Þß à©á â©Þãä á à(åæá çè éÞ 2êàë à ìí êîðï ñò ó Ý Þô õ ï2åö éá ÷ö éø ùTó Ý Þò Ø¤Ù Ø ú û ü ý þ ÿ¡ £¢¥¤¦¤ þ §©¨£§©¡©§£¢  ý þ ÿ¡ ! #£$ $%¡¡%¡'¡(#£$ $%¡¡%£) 021 3 45 67 128 9@©A 1 B¦C ) D 0 3 E 6 F¡G£H¥1¦1 6 I©PQ£I©R4¡SS©I£T4HU 4VW4X¡Y `F1¦a2S¡XbE 6 F¡S A `4X #£$ $%¡¡%¡ 0c1 3 45 67 128 9@©A 1 dWe fg h icp¦q¡r©f¦is t©u v w x©y€£‚ ƒW‚„ y¦x¡…2y£‚ …W‚ ‚†b¡†ˆ‡ ‰ ¦‘ v v ’c “  t©u ” •ƒW‚–©y£‚ —cw ˜™x¡‚ d •…Wef t©u g h i ‘bx† jk•ƒW‚–©y£‚ —l¦mefˆ‡ ‰ ¦‘ npoqWrs©t£r u vcw xbybz2{| } ~€2~2y‚ ƒ„ … † ‡ ˆ ‰ Š ‹©Œ£‹©Ž‘ ¡’¡“W“¥”• ‹£‡ Š –˜— ‘ ‰¦™‰š…™› ˆ œ ƒ„  Œ¡‹£Ž¥bž Ÿ  ¡¢ cž £ b¢‰2œ©‹¦ž ™b¤©¥—¡b‹¦ž œ©‹¦£§ £¢cž œ©‹¦£§œ ˆ ¨£œ b¨¥‡2¢¡©©ž ¤©›š… “c ª ¡ « ’£¤W¬ “c ª ¡b­ ®W¯ °±¡²b³´µ¶¸· ¹º » ¼½ ¾W¿À©Á¡ÂbÃãÂÄ Á£¾Å ½ ÆWÇ È£Ã£É ÆcÊ£Ë Ì ¾˜Í2ΡÏÆ ½ éÐȣéÑ ÒÓ Ô ¼½ ¾W¿¦ÀÁ¡ÂbÃãÂÄ ÇÕ Â¡Ö¡ÅWÅ¥×Ø Ã£Ù ½ ¾ ÒÓ Ú ¼½ ¾c¿¦ÀÁ¡ÂbÃãÂÄ Ê¦Î¡Å ÛcÜ Ý Þcß2à©á¡â£Þ ã á¡ä©Þå£ä æ çè éêWëìí îï¡ð¦ñò ó©ó©ô©ñõö ôW÷ ø ù ú¡ñ òû üý©÷bð¦þÿWò¡ ©ú£ò ¢¤£¦¥§¢î ¨bõ¡û ©¦¥¡ò ø õ¡÷©û ¥¡ò ø þ ý ù !# $% ¦' ( )10 234 65 7 8@9 2 A¤B C1D#EGF§H@IQP R@S§F§P I¤TU@P F V U@W X¤Y `a§b `c de`a§bf@g h i¡p¤i@qsr t u1v w@x x y1€  w@x x y¤€   ‚ƒ‚ƒ‚…„ †@‡…ˆ x ‰ „ @‘§„ x w ’† ‚ƒ‚“ˆ x w@@‚
  • 2. -2-  ¢¡¤£¦¥¨§© ¢¢ ¡¨ ¢££¦ !# $ % ')(10¢234576 8¢9@BA¨C)DBDEGF¤H I PQ R 9 SBTVUW1XY `1a bdcWBefbBg efhUfeBi a pBg qr ¢s t u vw¢xy€ ƒ‚)„¨…G† ‡1ˆ1…G‰ ‘“’ ” •–—B˜™ —1dfe¢g h ij˜k1dml n1™ op™ kB—foBq —f–˜f—B• rs Gt)u v w xydx z¨{)|1}¢~€7‚ xƒdx z¨{)|B„ …f†¤„B‡ ˆƒ{)€‰ Š|‹ Œ w €)„ …f†¤„B‡ x7#x z¨{)|B|sGŽ¤u v w †  ‚ y  z{)|1}¢~€7‚ y¨ y ‘’“” • – —G˜ ™¨š › œ ž Ÿ¨  Ÿ¨  Ÿ ¡¢ £7¤1¥¤¥ printf(control string,variable list); ¦ control string §¨1©“ª « ¬)© « ­1®ƒ¯ °± ² ©f§¬G³G´¨° ¯ µ « ¶1§¬G·§ ¸´ ¯¹ ºj»)·¢·°1µ¤¯¨1©© « ­f±¨¯G¼ §1¬ ·¢§ ¸´ ¯¹ ºj»)·¢·¤­f³G¯G»1¶1½¾f¿¨À ¡BÁ Â)ÃÄÅ)¥jÄ ÆÇ ¤¡¢ £7¤1¥¤¥ È Ä¡É Ê ËÌ ÁƒÇ¤ÍΠĢÅ)Í)ǤÁƒÇ¤ÍÎ ÏÐ ÏÑ ÏÒ ÏÓ ÏÔ ÏÖÕ ÏØ× ÙÚ ÙØÛ ÙÖÙ Ü Ý Þ)ß Ý àfá¨âGã ä å1á¢æ çè Gé¨ÞGé¤ä Üê ë ä åfáì é¨âí îjï)ð¢ðjä ß1àfñ òó õôä é¨é¤ä ö÷1øfå ä å1á¢ùƒúéû1øBë ü ýfþ¢ÿ¡ £¢¥¤¡¦¨§ ©¡ ü ýfþ ! £# $£#¥% ' ()( 01 2¡3¨% 145 6 7¡8@9 (¡A % BCED¡£#¨F2G 9IH P 7 A# Q % 7 4Q R
  • 3. -3-   ¡£¢ ¢¥¤§¦§¤©¨§ ¢ #include stdio.h int x1 = 49, x2 = 0xF7, x3 = 0123; float y1 = -123.456, y2 = 1.23e04; char z = 'A'; char name[12] = rajamakala; main() { clrscr(); printf(x1 = %d n, x1); printf(x2 = %x x2 = %X x3 = %o n, x2, x2, x3) printf(y1 = %f y2 = %e n, y1, y2); printf(z = %c name = %s n, z, name); } x1 = 49 x2 = f7 x2 = F7 x3 = 123 y1 = -123.456001 y2 = 1.23000e+0 z = A name = rajamakala §©!#§$%! ' () 0213$($2 4 5§6879¥@2A B3C%D2E#FGH©I P Q R SUT VW X(Y`3a SUT Vcb d e` f a V g`£a Q R h i£p p¥q§r§q£s T pt #include stdio.h float x1 = 12.345, x2 = 1.234e+0 void main() { clrscr(); printf(%.4f n, x1); printf(%.1f n, x1); printf(%.2e n, x2); printf(%.1e n, x2); } 12.345 12.3 1.2e+0 1e+05
  • 4. -4-  ¢¡ £¢¡ ¤ ¥§¦ ¨© ¥! $#% $© '¦(¥¨) 0 1 2¢' 3 45 6)7%8%9@§A B CEDF)5)GHI5)@8 PF)QSR§T 5)U9 B V9WX Y B %m.ns V§9IW ` abEcd ef )g¢h)g ci pEq¢r)s(tu vwx cypEf)r €  x ‚%ƒ%„y…‚%†Is ‡ ˆ‰E…‘ ‰’ “I”• –§”• –— ˜ ™ d%e%fgEh¢i j kmlnpo qr s§tu)v w x y x zE{|)u)}~€y z€ x u)‚¢ƒ x u„ … †E‡ ‡)ˆ‰ˆŠ‹ ‡§Œ #include stdio.h char message[] = Education void main() { clrscr(); printf(%.8sXn, message); printf(%12.7sXn, message) printf(%-12.6sXn, message } EducatioX EducatiX Educat X ¢Ž ¢Ž  ‘’“¢”•–)—˜™— š› $“¢œ•%IžŸ ¡$¢ £ ¤I¥I¦ ¦ § ¥¨¢©ª¤I«¬­ ¦ «® ¯ ° ± ²³ ´ µ ¶·¸¢¹º»)¼½¾¼ ¿À ¼I½ÁÀ Â(À ÁÃ Ä Å Ä Æ Ä Ç Ä È Ä É Ä Ê ËÌ Í Î¢ÏIÐ Ð Ñ Ò ÓÔ Õ Ö × Ø ÙÚ Î¢Û ×Ü ÝEØ Ù ×Þ)ÝàßâáEÑ ã ä å æç èé ê¢ëìíî ê¢ïIð ð ñ ò ó ôõ ö ê¢÷ ê ø ù)ú ÷ û ü ý%é%þÿæ ò ïIëìI÷ êõ è Eé ò ÿEô¢ð¢¡ £¥¤¥¤§¦
  • 5. -5-   ¡£¢ ¢¥¤§¦§¤©¨ ¢ #include stdio.h void main() { printf(“ComputertProgrammingn”); printf(“C Language”); printf(“bbbbProgramminga”); } Computer Programming C LangProgramming ©!£ §#%$')( 01#%$2 3 4 §#%!5¥67§!1084 93 @7A B C D EFG FH IP Q R S TU V'W§X8X Y`a `b cd e f a%b g9e f a'c h i pq9r s t uv§wx9y1€  ‚ w ƒ „… †‡ ˆ ‰  ‘ t x9y§’ ƒ t “7y§’ ƒ t €” † y§w•©u – t uv§w)—1˜§™„ … †‡ ˆ ‰  ‘ t x9y§’ ƒ t “7y§’ ƒ t €” † y§w•©u de fe g h i§j1k8l m9n o7p1q%rs tn 1uv§hw'j§x ym%z {¥| } putchar() ~ € '‚§ƒ8ƒ putchar(char) „ …£† †¥‡§ˆ§‡£‰1Š †‹ #include stdio.h char c = 'F'; void main() { putchar(c); gotoxy(3,2); putchar('a'); } Fa
  • 6. -6-  ¢¡ £¥¤§¦§¨ ©¨§ ¥ ¢ £¢!¤$#¥% ¦' ( ¥#$¨ ©¨§ ) 01 132$4$2$5¥6 187 #include stdio.h main() { int a fprintf(stdprn,C programmingn); a = 20; fprintf(stdprn,a = %dn,a); } 9 6 @A3B BC DE F G$H I P 9 6 Q @A3B BC DE F G$H I P¥R F S$T scanf() U BI VXW$DD scanf(control,variable1, variable2, Y control `a GbE F G ` S3A3HcWdPe fB a G$B f C g ` S3D ` h H¥BI VXW$DD i f H a G$p @C D printf() Y variable `a GqWdGR i R¥B gEG$r§s C S$W$VB U f A8@¥t IF u v F Vw§G$p¢E F G$H I Pdx§H ys¥B r$@ C Dv¢p€$R¥EG$r§s C S$W$VB  e ‚8ƒ A3u f F i @€$R „ …†§‡ ˆ‰ ‘’„ „ “d„
  • 7. -7-   ¡£¢ ¢¥¤§¦§¤§¦©¨ ¢ #include stdio.h int age,day,month,year; char name[15], surname[30]; void main() { clrscr(); printf(Insert age : ); scanf(%d,age); printf(You are %d years old.n,age); getch(); clrscr(); printf(Insert birthdate dd,mm,yyyy :); scanf(%d %d %d,day,month,year); printf(Your birthdate is %d/%d/%dn,day,month,year); getch(); clrscr(); printf(Insert name surname :); scanf(%s %s,name,surname); printf(Hi %s %sn,name,surname); getch(); } Insert age : 17 You are 17 years old. Insert birthdate dd,mm,yyyy :10 11 12 Your birthdate is 10/11/12 Insert name surname :abc def Hi abc def
  • 8. -8-  ¢¡ £ ¤¦¥¨§¨§© ¦ © ¤!§ $#¢¦¨%¦'§(0) ¤ 1  ¢¡ £¡ 2 ¤¥ §¨§© ¦ 435¦6© ¤!§ 7 8¦9 getchar() @ AB CD E F GH I¦PQ0I¢R FB S0DAR TU E F V¨WQ4X Y` ab cV0F B S0DAR U¦dGe E f X WQ4X Y g h¨i p0q r st u vwx y€ u4‚4ƒ¦„6…¢†¢‡¦s r w€ ˆ! …¢… variable = getchar(); ‰¢ ‘ ‘ ’¦“ ”¨”•–— ˜ ™¦d e f4ghf¦i6™• ’—!” ij ˜ k¦l getch() r wt …v m s n€ o¦pq0o¢x st u0vwx rsq4t uv †w x„0s t u0vwx!y¨n z{m s „¨{¦|nƒ m } t sq4t u g h¨i p0q r st u vwx y¨n zy€ u4‚4ƒ¦„6…¢†¢‡¦s r w€ ˆ! …¢… variable = getch(); ~¦ €4 ~ u | w wt …¢v m s n€ opq x‚ ˆƒ0†v m s0s¦}|nƒ m } t gets() r w€ ˆ! …¢… gets(str) r str s„0s…{ t }  ˆ¢w ††‡ ƒ¢‚4{¦w‡¨„ u u4pq xˆ † m ‚ u‰ …¢v m s n€ o
  • 9. -9-   ¡£¢ ¢¥¤§¦§¤§¨© ¢ #include stdio.h char grade; char name[15]; void main() { clrscr(); printf(Name : ); gets(name); printf(Hi %sn,name); getch(); clrscr(); printf(Grade : ); grade = getchar(); printf(Programming Language grade = %c.n,grade); getch(); clrscr(); printf(Grade : ); grade = getch(); printf(nProgramming Language grade = %c.n,grade); getch(); } Name : asdf Hi asdf Grade : A Programming Language grade = A Grade : Programming Language grade = B
  • 10. -10- 7KDQNRX  ¢¡¤£¦¥§¡¤¨©£© ¡¤! #%$'%# (0)1)%23%4¢5 687 9A@
  • 11. -11-  ¢¡ £¥¤¢¦ §¨©¥! #¦ $% '¢( )#0 123 ( 4¢¦ 5!§6879@!©¥ A¢BC 5 D 4EF20 12  ¢¡   G5! 4  ¢¡ H G593 12¤  ¢¡ I G590 P Q  ¢¡ R G5!EF2  ¢¡ S ¦ 7TU£¢2¥92 EF2  ¢¡ V W XY¢` abc d e f8f8f#g g g g g g g h8h8h