Input two strings and merge them in third string.
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main ( )
{
char nm1[80], nm2[80], nm3[80];
int ln1, ln2, j, i = 0;
clrscr ( );
printf("\n\n\n\t\t Enter first string..........:"); gets (nm1);
printf("\n\n\n\t\t Enter second string.....:"); gets (nm2);
ln1 = strlen (nm1);
ln2 = strlen (nm2);
for ( j = 0; j < ln1; j++ )
{
nm3[i++] = nm1[ j];
}
for ( j = 0; j < ln2; j++ )
{
nm3[i++] = nm2[ j];
}
nm3[i] = '\0';
printf("\n\n\n\t\t Merge String....: %s",nm3);
getch ( );
}
Click here to contact us
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main ( )
{
char nm1[80], nm2[80], nm3[80];
int ln1, ln2, j, i = 0;
clrscr ( );
printf("\n\n\n\t\t Enter first string..........:"); gets (nm1);
printf("\n\n\n\t\t Enter second string.....:"); gets (nm2);
ln1 = strlen (nm1);
ln2 = strlen (nm2);
for ( j = 0; j < ln1; j++ )
{
nm3[i++] = nm1[ j];
}
for ( j = 0; j < ln2; j++ )
{
nm3[i++] = nm2[ j];
}
nm3[i] = '\0';
printf("\n\n\n\t\t Merge String....: %s",nm3);
getch ( );
}
No comments:
Post a Comment