Search This Blog

Thursday, October 13, 2011

Program to read a line of text and display characters vertically.

   1:  #include<stdio.h>
   2:  #include<conio.h>
   3:  void main()
   4:  {
   5:  char line[80];
   6:  int i,l;
   7:  printf("Enter the Line:\n");
   8:  for(i=0;i<80;i++)
   9:  {
  10:  scanf("%c",&line[i]);
  11:  if(line[i]=='\n')
  12:  break;
  13:  }
  14:  l=i;
  15:  printf("the characters in the line are\n");
  16:  for(i=0;i<l;i++)
  17:  printf("%3d %c\n",i,line[i]);
  18:  getch();
  19:  }

No comments:

Post a Comment