1.

Write a C program to read a line of text containing a series of words from the terminal. 

Answer»

#include<stdio .h>

#include<conio . h>

void main() 

{

char text[100],ch;

int i=0;

clrscr();

printf("Enter text. Press at the end\n"); do

{ ch=getchar();

text[i]=ch;

i++;

}while(ch!='\n');

i=i-1;

text[i]='\0';

printf("The entered text is");

printf("\n%s\n",text);

getch();

}



Discussion

No Comment Found

Related InterviewSolutions