$B$6$6Cn%m%4(J


$B#C8@8lF~Lg(J
Introduction of The C Programming Language

$B"%#C8@8lL\


$B!!;XDj$N2s?t$@$17+$jJV$9!J(J for $BJ8!K(J

$B!!%W%m%0%i%`$G$O!"!VF1$8=hM}$r2?2s$b7+$jJV$9!W!"$H$$$&>l9g$,$"$j$^$9!#(J $B4JC1$K$O$=$l$i=hM}$r2s?tJ,$@$1%3%T!<$9$l$P$h$$$N$G$9$,!"(J $B7+$jJV$7$N2s?t$,8GDj$5$l$J$$$H$3$NJ}K!$G$O2r7h$7$^$;$s!#(J $B$=$l$K!"%9%^!<%H$JJ}K!$H$O8@$($^$;$s!#(J
$B!!$3$N!"F1$8=hM}$r7+$jJV$9$K$O!"7+$jJV$79=B$$rMxMQ$9$k$HJXMx$G$9!#(J $B7+$jJV$79=B$$N5-=RJ}K!$O$$$/$D$+$"$j$^$9$,!"(J $B$^$:!";XDj2s?t$,A0$b$C$FJ,$+$C$F$$$k>l9g$r9M$($^$9!#$3$N>l9g$O(J for $BJ8$r;H$$$^$9!#(J $B0J2<$N(IX=D(J4.1$B$NDL$j$K%W%m%0%i%`$rF~NO!"J]B8!"%3%s%Q%$%k$7$F

(IX=D(J4.1 $B#1$+$i(J10$B$^$G$N9g7W!&$=$N#1(J --------------------------------------------------------- #include <stdio.h> main() { $B!!!!(Jint i, total = 0; /* $B%+%&%s%?JQ?t(J i $B$H!"9g7WCM$rF~$l$kJQ?t(J total $B$r@k8@(J */ /* $BJQ?t(Ji$B$,(J 1 $B$+$i(J 10 $B$^$G7+$jJV$9(J */ $B!!!!(Jfor (i = 1; i <= 10; i++) { /* $B%+%&%s%?$r(J 1 $B$K=i4|2=!"7QB3>r7o$O(J i $B$,(J 10 $B$K$J$k$^$G(J */ $B!!!!!!!!(J /* $B%+%&%s%?$N99?7J}K!$O(J 1 $B$r2C;;(J */ $B!!!!!!!!(Jtotal += i; /* total $B$K(J i $B$NCM$r2C;;(J */ $B!!!!(J} $B!!!!(Jprintf("total = %d\n", total); /* total $B$NFbMF$r=PNO(J */ }

$B!|!!;XDj$7$?2s?t$K$J$k$^$G7+$jJV$7=hM}$r $B!Z9=J8![(J$B!!!!(Jfor ( $B%+%&%s%?$N=i4|2=(J; $B7QB3>r7o(J; $B%+%&%s%?$N99?7J}K!(J ) {
$B!!!!!!!!!!!!!!!! $B!!!!!!!!!!!!(J}
$B=hM}$,#19T$N>l9g$O(J { } $B$O>JN,2DG=$G$9(J

$B!!$"$k>r7o$K$J$k$^$G7+$jJV$9!J(J while $BJ8!K(J

$B!!7+$jJV$92s?t$,J,$+$i$J$$$H$-$O$I$&$7$?$iNI$$$G$7$g$&!#(J $B$"$k>r7o$K$J$k$^$G7+$jJV$9(Jwhile $BJ8$r;H$$$^$9!#(J $B0J2<$N(IX=D(J4.2$B$NDL$j$K%W%m%0%i%`$rF~NO!"J]B8!"%3%s%Q%$%k$7$F

(IX=D(J4.2 $B#1$+$i(J10$B$^$G$N9g7W!&$=$N#2(J --------------------------------------------------------- #include <stdio.h> main() { $B!!!!(Jint i, total = 0; /* $B%+%&%s%?JQ?t(J i $B$H!"9g7WCM$rF~$l$kJQ?t(J total $B$r@k8@(J */ $B!!!!(Ji = 1; /* $B%+%&%s%?$r(J 1 $B$K=i4|2=!"(Jwhile $B%k!<%W$NA0$KI,MW$G$9!#(J */ /* $BJQ?t(J i $B$,(J 1 $B$+$i(J 10 $B$^$G7+$jJV$9(J */ $B!!!!(Jwhile (i <= 10) { /* $B7QB3>r7o$O(J i $B$,(J 10 $B$K$J$k$^$G(J */ $B!!!!!!!!(Jtotal += i; /* total $B$K(J i $B$NCM$r2C;;(J */ $B!!!!!!!!(Ji++; /* $B%+%&%s%?$N99?7J}K!$O(J 1 $B$r2C;;!"(Jwhile $B%k!<%W$N:G8e$KI,MW(J */ $B!!!!(J} $B!!!!(Jprintf("total = %d\n", total); /* total $B$NFbMF$r=PNO(J */ }

$B!|!!;XDj$7$?>r7o$N4V!"=hM}$r7+$jJV$7=hM}$r $B!Z9=J8![(J$B!!!!(Jwhile ( $B7QB3>r7o(J ) {
$B!!!!!!!!!!!!!!!! $B!!!!!!!!!!!!(J}

$B!!0J2<$N$*$^$1$N%W%m%0%i%`$O!"F~NO$7$?J8;zNs$NFbMF$r=PNO$9$k%W%m%0%i%`$G$9!#(J $B$?$a$7$F$_$F$/$@$5$$!#(J

$B$*$^$1!!NcJ8(J1 $BF~NO$7$?J8;zNs$NFbMF$O!)(J ------------------------------------------------------ /* * $BJ8;zNs$NFbMF$r=PNO$9$k(J */ #include <stdio.h> main() { $B!!!!(J/*$B!!JQ?t$N@k8@(J */ $B!!!!(Jint i; // $B%$%s%G%C%/%9(J $B!!!!(Jchar str[80]; // $BJ8;zG[Ns(J $B!!!!(Jscanf("%s", str ); /* $BJ8;zG[Ns$KJ8;zNs$rF~NO(J */ $B!!!!(J/* $B#1J8;z$:$D=PNO(J */ $B!!!!(Ji = 0; /* $B%+%&%s%?$r(J 1 $B$K=i4|2=!"(Jwhile $B%k!<%W$NA0$KI,MW$G$9!#(J */ $B!!!!(Jwhile ( str[i] != '\0' ) { /* $B7QB3>r7o$O(Jstr[i] $B$,(J \0$B!JJ8;zNs$N:G8e$N0u!K(J $B$K$J$k$^$G(J */ $B!!!!!!!!(Jprintf("%c", str[i]); $B!!!!!!!!(Ji++; /* $B%+%&%s%?$N99?7J}K!$O(J 1 $B$r2C;;!"(Jwhile $B%k!<%W$N:G8e$KI,MW(J */ $B!!!!(J} $B!!!!(Jprintf("\n"); }

$B!!A0H=Dj$H8eH=Dj!J(J do$B!A(Jwhile $BJ8!K(J

$B!!7+$jJV$9$+$I$&$+$r!"$$$DH=Dj$9$k$+!#$=$l$K$h$C$F!"A0H=Dj$H8eH=Dj$N#2$D$KJ,$1$i$l$^$9!#(J $B:#$^$G$N!"(J for $BJ8!"(Jwhile $BJ8$r;H$C$?7+$jJV$79=B$$O$9$Y$FA0H=Dj$G$7$?!#(J $BA0H=CG$N>l9g!"7QB3>r7o$K$h$C$F$O!"7+$jJV$7=hM}$,0lEY$b

(IX=D(J4.3 $B#1$+$i(J10$B$^$G$N9g7W!&$=$N#3(J --------------------------------------------------------- #include <stdio.h> main() { $B!!!!(Jint i, total = 0; /* $B%+%&%s%?JQ?t(J i $B$H!"9g7WCM$rF~$l$kJQ?t(J total $B$r@k8@(J */ $B!!!!(Ji = 1; /* $B%+%&%s%?$r(J 1 $B$K=i4|2=!"(Jwhile $B%k!<%W$NA0$KI,MW$G$9!#(J */ /* $BJQ?t(J i $B$,(J 1 $B$+$i(J 10 $B$^$G7+$jJV$9(J */ $B!!!!(Jdo { $B!!!!!!!!(Jtotal += i; /* total $B$K(J i $B$NCM$r2C;;(J */ $B!!!!!!!!(Ji++; /* $B%+%&%s%?$N99?7J}K!$O(J 1 $B$r2C;;!"(Jdo $B!A(J while $B%k!<%W$N:G8e$KI,MW(J */ $B!!!!(J} while (i <= 10); /* $B7QB3>r7o$O(J i $B$,(J 10 $B$K$J$k$^$G!"(Jwhile ( ) $B$N8e$K(J ; $B$,I,MW(J */ $B!!!!(Jprintf("total = %d\n", total); /* total $B$NFbMF$r=PNO(J */ }

$B!|!!;XDj$7$?>r7o$N4V!"=hM}$r7+$jJV$7=hM}$r8eH=Dj$K$F $B!Z9=J8![(J$B!!!!(Jdo {
$B!!!!!!!!!!!!!!!! $B!!!!!!!!!!!!(J} while ( $B7QB3>r7o(J );
while ( $B7QB3>r7o(J ) $B$N8e$K$O(J ; $B$,I,MW$G$9(J

$B!!0J2<$N$*$^$1$N%W%m%0%i%`$O!"F~NO$7$?J8;z$,(I"(Jz(I#$B$K$J$k$^$GF~NOBT$A$rB3$1$k%W%m%0%i%`$G$9!#(J $B$?$a$7$F$_$F$/$@$5$$!#(J

$B$*$^$1!!NcJ8(J2 $B#z$rF~NO$9$k$^$GBT$C$F$^$9(J ---------------------------------------------------- #include <stdio.h> main() { $B!!!!(J/*$B!!JQ?t$N@k8@(J */ $B!!!!(Jint str; //$BF~NOJ8;z(J $B!!!!(J/* $B#1J8;z$rF~NO!"(Jz $B$^$?$O(J Z $B$,F~NO$5$l$k$^$G7+$jJV$9(J */ $B!!!!(Jdo { $B!!!!!!!!(Jstr = getchar(); /* $B#1J8;zF~NO(J */ $B!!!!(J} while ( ( str != 'z' ) && ( str != 'Z' ) ); /* $B7QB3>r7o$O(Jstr $B$,(J z $B$^$?$O(J Z $B$K$J$k$^$G(J */ }

$BA0H=Dj$H8eH=Dj$NA*$SJ}(J
$B#z(J $B$^$?$O(J Z $B$rF~NO$9$k$^$GBT$C$F$^$9(J
$B!|!!A0H=Dj$K$h$k5-=R(J
str = getchar();
while ( ( str != 'z' ) && ( str != 'Z' ) ) {
$B!!!!(Jstr = getchar();
}
$B!|!!8eH=Dj$K$h$k5-=R(J
do {
$B!!!!(Jstr = getchar();
} while ( ( str != 'z' ) && ( str != 'Z' ) );

$B!!7+$jJV$7$rBG$A@Z$k!J(J continue $BJ8(J / break $BJ8!K(J

$B!!(Jfor $B%k!<%W$G$O7+$jJV$7$?2s?t!"(Jwhile $B%k!<%W$H(J do $B!A(J while $B%k!<%W$G$O;XDj$7$?>r7o<0$,!"(J $B7+$jJV$7$r=*N;$9$k@55,$NJ}K!$G$9!#$7$+$7!">l9g$K$h$C$F$O7+$jJV$7$r=*N;$7$?$j!"(J $B=hM}$r%9%-%C%W$7$F%k!<%W$N@hF,$KLa$7$?$$$3$H$,$"$j$^$9!#(J $B7+$jJV$7$rESCf$G=*N;$9$k$K$O(J break $BJ8$r!"(J $B=hM}$r%9%-%C%W$7$F7+$jJV$7%k!<%W$N@hF,$KLa$9$K$O(J continue $BJ8$r;H$$$^$9!#(J
$B!!$=$l$G$O!"0J2<$N(IX=D(J4.4 $B$H(IX=D(J4.5 $B$NDL$j$K%W%m%0%i%`$rF~NO!"J]B8!"(J $B%3%s%Q%$%k$7$F

(IX=D(J4.4 $BAG?t$NH=Dj!J(J break $BJ8(J $B!K(J ------------------------------------------------------------- /* * $BAG?t$NH=Dj(J * $B!!F~NO$7$??tCM$r(J 2 $B!A(J $BF~NOCM$^$G$N?tCM$G=g$K3d$j;;$7!"3d$j@Z$l$k?tCM$r5a$a$k(J * $B!!3d$j@Z$l$k?tCM$,F~NOCM$H0lCW$7$?$H$-!"$9$J$o$AF~NOCM0J30$K3d$j@Z$l$k?tCM$,$J$$$H$-(J * $B!!F~NO$7$??tCM$OAG?t$G$9!#(J */ #include <stdio.h> main() { $B!!!!(J/*$B!!JQ?t$N@k8@(J */ $B!!!!(Jint i, a; /* $B%+%&%s%?JQ?t(J i $B$H!"CM$rF~$l$kJQ?t(J a $B$r@k8@(J */ $B!!!!(Jscanf("%d", &a); /* a $B$KF~NO(J */ $B!!!!(Jfor (i = 2; i <= a; i++) { /* 2 $B$+$i(J a $B$^$G7+$jJV$9(J */ $B!!!!!!!!(Jif ((a % i) == 0) { /* a $B$r(J i $B$G3d$C$?M>$j$r5a$a(J */ $B!!!!!!!!!!!!(Jbreak; /* 0 $B$G$"$l$P7+$jJV$7$rH4$1$k(J */ $B!!!!!!!!(J} $B!!!!(J} $B!!!!(Jif (i == a) /* a $B$OAG?t(J */ $B!!!!!!!!(Jprintf("%d is prime\n", a); $B!!!!(Jelse /* a $B$OAG?t$G$J$$(J */ $B!!!!!!!!(Jprintf("%d is not prime\n", a); } (IX=D(J4.5 $BJ8;z$NH=Dj!J(J continue $BJ8(J $B!K(J ----------------------------------------------------------- /* * $BF~NO?tCM$rJ8;z%3!<%I$H$7$F!"J8;z%3!<%I$HJ8;z$r=PNO(J */ #include <stdio.h> main() { $B!!!!!!(J/*$B!!JQ?t$N@k8@(J */ $B!!!!(Jint i, c; /* $B%+%&%s%?JQ?t(J i $B$H!"CM$rF~$l$kJQ?t(J c $B$r@k8@(J */ $B!!(J/* $BL58B$K7+$jJV$9(J */ $B!!!!(Jfor (i = 1;; i++) { /* $B7QB3>r7o$,>JN,$5$l!"L58B%k!<%W$H$J$k(J */ $B!!!!!!!!(Jscanf("%d", &c); /* a $B$KF~NO(J */ $B!!!!!!!!(Jif (c == (-1)) /* -1 $B$,F~NO$5$l$?$i7+$jJV$7$rH4$1$k(J */ $B!!!!!!!!!!!!(Jbreak; $B!!!!!!!!(Jelse if (c <= 32 || 127 <= c) /* c$B!e(J32 $B$^$?$O(J c$B!f(J127 $B$N>l9g(J, */ $B!!!!!!!!!!!!(Jcontinue; /* $B7+$jJV$7$N@hF,$KLa$k(J */ $B!!!!!!!!(Jelse $B!!!!!!!!!!!!(Jprintf("%x = %c\n", c, c); /* c $B$NFbMF$r=PNO(J */ $B!!!!(J} }

$B!|!!(Jbreak $BJ8(J
$B!Z9=J8![(J$B!!!!(Jif ( $B>r7o<0(J ) {
$B!!!!!!!!!!!!!!!!(Jbreak;
$B!!!!!!!!!!!!(J}

break $BJ8$N;H$$J}(J
$B!|(Jbreak $BJ8$O!"$=$l$r4^$s$@%V%m%C%/(J { } $B$r=*N;$9$k(J
$B!|(Jswitch $BJ8$G;HMQ$7$?>l9g$O!"(J $B0J9_$N(J case $B@a$r
$B!|(Jfor $B%k!<%W!"(Jwhile $B%k!<%W!"(J do $B!A(J while $B%k!<%W$G;HMQ$7$?>l9g!"@55,$N=*N;>r7o0J30$N>r7o$G!"7+$jJV$7%k!<%W$r=*N;$G$-$k(J

$B!|!!(Jcontinue $BJ8(J
$B!Z9=J8![(J$B!!!!(Jif ( $B>r7o<0(J ) {
$B!!!!!!!!!!!!!!!!(Jcontinue;
$B!!!!!!!!!!!!(J}


$BJdB-(J$B!!7+$jJV$7%k!<%W$r=*N;$G$-$k>r7o<0$,J#?t$"$k$H$-!"(J $B=*N;>r7o$r4^$^$J$$L58B%k!<%W$rMxMQ$7$F%W%m%0%i%`$r5-=R$7$^$9!#(J $B$J$*!"(IX=D(J4.5 $BJ8;z$NH=Dj!J(J continue $BJ8(J $B!K$O!"(Jfor $BJ8$K$h$kL58B%k!<%W$NNc$G$9!#(J

$BL58B%k!<%W$N5-=RJ}K!(J
$B!|!!(Jfor $BJ8(J $B!|!!(Jwhileh $BJ8(J
for ( $B%+%&%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