#include <stdio.h>
main ()
{
   printf("Hello, world!!!\n");
}

ࠦ 1-1.
     ய    ணࠬ  襩 ⥬. ஡
  ࠧ  ணࠬ  ᬮ  -
饭  訡   ⮬ .

#include <stdio.h>
main()
{
   printf("hello, ");
   printf("world");
   printf("\n");
}

ࠦ  1-2.
    ஢ ᯥਬ  ⮣, ⮡ 㧭,   ந-
,  ᫨  ப, 饩 㬥⮬ 㭪樨 printf
㤥 ᮤঠ \x,  x -  ᨬ,   室騩
 襯ਢ ᯨ᮪.

६  䬥⨪.

#include <stdio.h>
/*  ⠡ 室  ࠤᮢ ७  楫
for f = 0, 20, ..., 300 */
main()
{
   int lower, upper, step;
   float fahr, celsius;

   lower = 0;  /* lower limit of temperature table */
   upper =300; /* upper limit */
   step  = 20; /* step size */
   fahr = lower;
   while (fahr <= upper) {
      celsius = (5.0/9.0) * (fahr -32.0);
      printf("%4.0f %6.1f\n", fahr, celsius);
      fahr = fahr + step;
   }
}

ࠦ  1-3.
    ८ࠧ  ணࠬ  ॢ ⥬ ⠪ -
, ⮡  ⠫   ⠡.

ࠦ  1-4.
     ணࠬ  ᮮ⢥饩 ⠡  -
室  ࠤᮢ 楫  ࠤᠬ ७.

 for

#include <stdio.h>
main()  /* fahrenheit-celsius table */
{
   int fahr;
   for (fahr = 0; fahr <= 300; fahr = fahr + 20)
     printf("%4d %6.1f\n", fahr, (5.0/9.0)*(fahr-32.0));
}

ࠦ  1-5.
     ணࠬ ॢ ⥬ ⠪  -
,  ⮡  ⠫ ⠡  ⭮ 浪, .. 
300 ࠤᮢ  0.

᪨ ⠭

#include <stdio.h>
#define  LOWER 0/* lower limit of table */
#define  UPPER 300  /* upper limit */
#define  STEP  20  /* step size */
main () /* fahrenheit-celsius table */
{
   int fahr;
   for (fahr =LOWER; fahr <= UPPER; fahr =fahr + STEP)
      printf("%4d %6.1f\n", fahr, (5.0/9.0)*(fahr-32));
}

஢ 䠩.

main()  /* copy input to output; 1st version */
{
   int c;
   c = getchar();
   while (c != EOF) {
      putchar (c);
      c = getchar();
   }
}

main()  /* copy input to output; 2nd version */
{
   int c;

   while ((c = getchar()) != EOF)
   putchar(c);
}

 ᨬ.

main()  /* count characters in input */
{
   long nc;

   nc = 0;
   while (getchar() != EOF )
      ++nc;
   printf("%1d\n", nc);
}

 ப.

       ணࠬ  뢠  ⢮  ப 
䠩 . ।,  ப   稢
ᨬ    ப \n.

main()  /* count lines in input */
{
   int c,nl;

   nl = 0;
   while ((c = getchar()) != EOF)
      if (c =='\n')
         ++nl;
   printf("%d\n", nl);
}

ࠦ  1-6.
      ணࠬ   ஡,  ⠡権  
 ப.

ࠦ  1-7.
      ணࠬ,     뢮, -
  ⮬  ᫥⥫쭮    
஡   ஡.

 ᫮.

ணࠬ 뢠 ⢮ ப, ᫮    ᨬ,
ᯮ  ⮬ 쬠 ப ।,  ᫮
  ᫥⥫쭮 ᨬ,  ᮤঠ ஡,
⠡権      ப. / - 饭  ⨫
'wc' ⥬ 'UNIX'

#define    YES  1
#define    NO   0

main()  /* count lines, words, chars in input */
{
   int c, nl, nw, inword;

   inword = NO;
   nl = nw = nc = 0;
   while((c = getchar()) != EOF)  {
       ++nc;
       if (c == '\n')
            ++nl;
       if (c==' ' || c=='\n' || c=='\t')
            inword = NO;
       else if (inword == NO)  {
            inword = YES;
            ++nw;
       }
   }
   printf("%d %d %d\n", nl, nw, nc);
}

ࠦ  1-9.
        ⠫ ஢ ணࠬ  ᫮ ? -
  ࠭祭 ?

ࠦ  1-10.
      ணࠬ,   㤥    ᫮  
䠩 , 祬    ப.

ࠦ  1-11.
     ।  ணࠬ   ᫮, ᯮ 襥
। "᫮"; ⠩,  ਬ  ᫮  ᫥-
⥫쭮 㪢,   䮢, 稭  㪢.

ᨢ.

ணࠬ  ᫠  -
 , ᨬ    ஬⪮/஡,  ⠡樨,
  ப/   ⠫ ᨬ.

main()  /* count digits, white space, others */
{
   int  c, i, nwhite, nother;
   int  ndigit[10];

   nwhite = nother = 0;
   for (i = 0; i < 10; ++i)
      ndigit[i] = 0;

   while ((c = getchar()) != EOF)
      if (c >= '0' && c <= '9')
         ++ndigit[c-'0'];
      else if(c== ' ' || c== '\n' || c== '\t')
         ++nwhite;
      else
         ++nother;

   printf("digits =");
   for (i = 0; i < 10; ++i)
      printf(" %d", ndigit[i]);
   printf("\nwhite space = %d, other = %d\n",nwhite, nother);
}

ࠦ  1-12.
      ணࠬ,  ⮣ࠬ  ᫮ 
䠩  .    -  ⮣ࠬ ਧ-
⠫쭮; ⨪쭠 ਥ ॡ  ᨫ.

㭪樨

main()  /* test power function */
{
   int i;

   for(i = 0; i < 10; ++i)
    printf("%d %d %d\n",i,power(2,i),power(-3,i));
}

power(int x, int n)  /* raise  x  n-th power; n > 0  */
{
   int i, p;
   p = 1;
   for (i =1; i <= n; ++i)
   p = p * x;
   return (p);
}

ࠦ  1-13.
      ணࠬ  ८ࠧ  ய  㪢  
䠩   , ᯮ  ⮬ 㭪 power(c),
 頥 祭 'c', ᫨ 'c'-  㪢,   -
祭 ᮮ⢥饩 筮 㪢, ᫨ 'c'-㪢.

㬥 - 맮  祭.

power(int x, int n)  /* raise  x  n-th power; n > 0;
          version 2 */
{
   int p;

   for (p = 1; n > 0; --n)
      p = p * x;
   return (p);
}

ᨢ ᨬ.

ணࠬ,  ⠥  ப  ⠥ ᠬ -
  . ᭮ 奬 ணࠬ 筮 :

  while (  ப)
    if ( ப  ᠬ  
    ।)
         ப   
   ᠬ  ப

#define  MAXLINE  1000 /* maximum input
      line size */
main()  /* find longest line */
{
   int len; /* current line length */
   int max; /* maximum length seen so far */
   char line[MAXLINE]; /* current input line */
   char save[MAXLINE]; /* longest line, saved */
   max = 0;
   while ((len = getline(line, MAXLINE)) > 0)
      if (len > max) {
         max = len;
         copy(line, save);
       }
   if (max > 0)   /* there was a line */
   printf("%s", save);
}

getline(char *s, int lim) /* get line into s,return length */
{
   int c, i;
   for(i=0;i<lim-1 && (c=getchar())!=EOF && c!='\n';++i)
      s[i] = c;
   if (c == '\n')  {
      s[i] = c;
      ++i;
   }
   s[i] = '\0';
   return(i);
}

copy(char *s1, char *s2)    /* copy s1 to s2;
              assume s2 big enough */
{
   int i;
   i = 0;
   while ((s2[i] = s1[i] != '\0')
      ++i;
}

ࠦ  1-14.
     ।   ணࠬ ᪠ ᠬ  -
 ப ⠪ ࠧ, ⮡  ࠢ쭮 ⠫ 
᪮ 㣮      ப      訩
⥪.

ࠦ   1-15.
       ணࠬ   ப  80 ᨬ-
.

ࠦ  1-16.
      ணࠬ,   㤥  㤠    
ப  騥   ஡  ⠡樨,  ⠪ ப,
楫 騥  ஡.

ࠦ  1-17.
      㭪 reverse(s),   ᯮ  ᨬ-
  ப  s  ⭮ 浪.    
ணࠬ,    ப  䠩 .
