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