$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
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
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$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