Pages

Adsense responsive

Saturday, 16 February 2013

C PROGRAM: TO JOIN TWO STRINGS

CODING:
#include<conio.h>
#include<stdio.h>
#include<string.h>
void main()
{
 int i,j;
 char name[50],name1[25],name2[25];
 clrscr();
 printf("Enter first string: ");
 gets(name1);
 printf("Enter second string: ");
 gets(name2);
 for(i=0;name1[i]!='\0';i++)
  name[i]=name1[i];
 name[i]=' ';
 for(j=0;name2[j]!='\0';j++)
  name[i+j+1]=name2[j];
 name[i+j+1]='\0';
 printf("\n\nJoined String: %s",name);
 getch();
}


CODING

OUTPUT

For any query or suggestion please comment below...

No comments:

Post a Comment