Completely Solved C, C++ Programs Assignment.




C Program to accept a string print each word in new line.

Filed Under:

Problem 31. C Program to accept a string print each word in new line.
#include<stdio.h>
#include<conio.h>
main( )
{
char ch;
clrscr( );
printf(“enter a string :”);
while(( ch=getchar( ))!=’n’)
{
putchar(ch);
if(ch= =’ ‘)
printf(“n”);
}
getch( );
}

C compiler: gcc 4.1.2

 Back to main directory: Sample C Program | Software Practical | Solved C Assignment


Get Free Programming Tutorials and Solved assignments