# include <stdio.h>
# include <conio.h>
void main()
{
char str1[20], str2[20], strcon[40] ;
int i, j ;
clrscr() ;
printf("Enter the first string : ") ;
scanf("%s", str1) ;
printf("\nEnter the second string : ") ;
scanf("%s", str2) ;
for(i = 0 ; str1[i] != '\0' ; i++)
strcon[i] = str1[i] ;
i-- ;
for(j = 0 ; str2[j] != '\0' ; j++)
strcon[i+j+1] = str2[j] ;
strcon[i+j+1] = '\0' ;
printf("\nThe concatenation string is : %s", strcon) ;
getch() ;
}
RUN 1 :
~~~~~~~
Enter the first string : Anna
Enter the second string : University
The concatenation string is : AnnaUniversity
# include <conio.h>
void main()
{
char str1[20], str2[20], strcon[40] ;
int i, j ;
clrscr() ;
printf("Enter the first string : ") ;
scanf("%s", str1) ;
printf("\nEnter the second string : ") ;
scanf("%s", str2) ;
for(i = 0 ; str1[i] != '\0' ; i++)
strcon[i] = str1[i] ;
i-- ;
for(j = 0 ; str2[j] != '\0' ; j++)
strcon[i+j+1] = str2[j] ;
strcon[i+j+1] = '\0' ;
printf("\nThe concatenation string is : %s", strcon) ;
getch() ;
}
RUN 1 :
~~~~~~~
Enter the first string : Anna
Enter the second string : University
The concatenation string is : AnnaUniversity
No comments:
Post a Comment