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