Re: Problem with printing input.



try execute this program ...
if input is this ...
hey you rama krishna
output:
hey
you
rama
krishna
is that what u want ?

#include <stdio.h>

/* print the input one word per time on different lines */

int main(void)
{
int c;

while ((c = getchar()) != EOF) {
if (c == ' ' || c == '\n' || c == '\t')
putchar('\n');
else
putchar(c);

}

return 0;
}

.



Relevant Pages