Input a name and print last name (using two string).
#include <stdio.h>
#include <conio.h>
void main ( )
{
char nm[80], sn[80] ;
int i, j, ln, k = 0;
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++ );
for ( j = i + 1; j < ln; j++ )
{
sn[k++] = nm[ j];
}
sn[k] = '\0';
printf("\n\n\n\t\t LAST NAME....: %s", sn);
getch ( );
}
Click here to contact us
#include <stdio.h>
#include <conio.h>
void main ( )
{
char nm[80], sn[80] ;
int i, j, ln, k = 0;
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++ );
for ( j = i + 1; j < ln; j++ )
{
sn[k++] = nm[ j];
}
sn[k] = '\0';
printf("\n\n\n\t\t LAST NAME....: %s", sn);
getch ( );
}
Click here to contact us
No comments:
Post a Comment