C Program to Concatenate Two Strings
/*
Write a program to append one string to another String.
*/
#include <stdio.h>
int main(void) {
// your code goes here
char str1[100],str2[50];
int i,j;
printf("Enter the First String : ");
scanf("%s",str1);
printf("Enter the Second String : ");
scanf("%s",str2);
for(i=0;str1[i]!='\0';i++)
{
}
for(j=0;str2[j]!='\0';j++)
{
str1[i]=str2[j];
i++;
}
str1[i]='\0';
printf(" Concatenated String : %s",str1);
return 0;
}
Write a program to append one string to another String.
*/
#include <stdio.h>
int main(void) {
// your code goes here
char str1[100],str2[50];
int i,j;
printf("Enter the First String : ");
scanf("%s",str1);
printf("Enter the Second String : ");
scanf("%s",str2);
for(i=0;str1[i]!='\0';i++)
{
}
for(j=0;str2[j]!='\0';j++)
{
str1[i]=str2[j];
i++;
}
str1[i]='\0';
printf(" Concatenated String : %s",str1);
return 0;
}
Comments
Post a Comment