#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char str1[20],str2[20],str3[50],ch;
int len1,len2,i,j;
clrscr();
printf("\n Enter the String 1:-");
scanf("%s",&str1);
printf("\n Enter the String 2:-");
scanf("%s",&str2);
for(len1=0;str1[len1]!='\0';len1++);
for(len2=0;str2[len2]!='\0';len2++);
for(i=0;i<(len1+len2);i++)
{
if(i<len1)
{
str3[i]=str1[i];
j=0;
}
else
{
str3[i]=str2[j];
j++;
}
}
str3[i]='\0';
printf("\n%s + %s = %s",str1,str2,str3);
getch();
}
#include<conio.h>
#include<string.h>
void main()
{
char str1[20],str2[20],str3[50],ch;
int len1,len2,i,j;
clrscr();
printf("\n Enter the String 1:-");
scanf("%s",&str1);
printf("\n Enter the String 2:-");
scanf("%s",&str2);
for(len1=0;str1[len1]!='\0';len1++);
for(len2=0;str2[len2]!='\0';len2++);
for(i=0;i<(len1+len2);i++)
{
if(i<len1)
{
str3[i]=str1[i];
j=0;
}
else
{
str3[i]=str2[j];
j++;
}
}
str3[i]='\0';
printf("\n%s + %s = %s",str1,str2,str3);
getch();
}
Output:
Post a Comment