Input a sentence and print all the words of that sentence.
#include <stdio.h>
#include <conio.h>
void main ( )
{
char nm[80];
int ln, j;
clrscr ( );
printf("\n\n\n\t\t Enter a sentence....:"); gets (nm);
for ( ln = 0; nm[ln] != '\0'; ln++ );
printf("\n\n\n\t\t WORDS....: ");
for ( j = 0; j < ln; j++ )
{
if ( nm[ j] == ' ' )
{
printf("\n\n\t\t\t\t");
}
else
{
printf("%c", nm[ j] );
}
}
getch ( );
}
Click here to contact us
#include <stdio.h>
#include <conio.h>
void main ( )
{
char nm[80];
int ln, j;
clrscr ( );
printf("\n\n\n\t\t Enter a sentence....:"); gets (nm);
for ( ln = 0; nm[ln] != '\0'; ln++ );
printf("\n\n\n\t\t WORDS....: ");
for ( j = 0; j < ln; j++ )
{
if ( nm[ j] == ' ' )
{
printf("\n\n\t\t\t\t");
}
else
{
printf("%c", nm[ j] );
}
}
getch ( );
}
Click here to contact us
No comments:
Post a Comment