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