Welcome to my blog this is test

28 June 2012

write a C program to READ A LINE OF TEXT A SERIES OF WORDS from the terminal


//Code:
#include
#include
#include
 void main()
  {
   char ch[20],charecter;
   int i=0;
   clrscr();
   printf("\n Enter any text : ");
    do
    {
     charecter=getchar();
     ch[i]=charecter;
     i++;
    }while(charecter!='\n');
    i=i-1;
    ch[i]='\0';
    printf("\n %s",ch);
   getch();
  }

/*Output:
Enter any text : my name is mostu mahalat
My name is mostu mahalat

No comments:

Post a Comment