//WAP TO CONCATENATE TWO STRINGS.
//WITHOUT USING LIBRARY FUNCTIONS
#include<stdio.h>
#include<conio.h>
void main()
{
char a[10],b[10],c[40];
int i,j;
clrscr();
printf("\n\nENTER FIRST STRING:");
gets(a);
printf("\n\nENTER SECOND STRING:");
gets(b);
for(i=0;a[i]!='\0';i++)
c[i]=a[i];
for(j=0;a[j]!='\0';j++)
{
c[i]=b[j];
i++;
}
c[i]='\0';
printf("\n\nTHE COMBINED STRING IS:");
puts(c);
getch();
}
/*************************************************************
OUTPUT
**************************************************************
ENTER FIRST STRING:ABHISHEK
ENTER SECOND STRING:WADHWA
THE COMBINED STRING IS:ABHISHEKWADHWA
*/
//WITHOUT USING LIBRARY FUNCTIONS
#include<stdio.h>
#include<conio.h>
void main()
{
char a[10],b[10],c[40];
int i,j;
clrscr();
printf("\n\nENTER FIRST STRING:");
gets(a);
printf("\n\nENTER SECOND STRING:");
gets(b);
for(i=0;a[i]!='\0';i++)
c[i]=a[i];
for(j=0;a[j]!='\0';j++)
{
c[i]=b[j];
i++;
}
c[i]='\0';
printf("\n\nTHE COMBINED STRING IS:");
puts(c);
getch();
}
/*************************************************************
OUTPUT
**************************************************************
ENTER FIRST STRING:ABHISHEK
ENTER SECOND STRING:WADHWA
THE COMBINED STRING IS:ABHISHEKWADHWA
*/
No comments:
Post a Comment