Read the four input string variables s1, s2, s3, s4 and store it in single string variable "COLLEGE" and display the string.
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
char s1[20],s2[20],s3[20],s4[20];
printf("Enter first string : ");
scanf("%s",s1);
printf("Enter second string : ");
scanf("%s",s2);
printf("Enter third string : ");
scanf("%s",s3);
printf("Enter fourth string : ");
scanf("%s",s4);
strcat(s1,s2);
strcat(s3,s4);
strcat(s1,s3);
char COLLEGE[strlen(s1)];
strcat(COLLEGE,s1);
printf("Concatenated String : %s",COLLEGE);
}
Comments
Leave a comment