Wednesday, 10 July 2019

write a programe to read a line of text containing a series of words from the terminal

#include<stdio.h>
main()
{
char line[81],character;
int c;
c=0;
printf("Enter text:");
do
{
character=getchar();
line[c]=character;
c++;
}
while(character!= '\n');
c=c-1;
line[c]='\n';
printf("\n%s\n",line);
}

No comments:

Post a Comment