Monday, August 20, 2018

CONCATENATE CODE

  • Problem Description

    Write a C program to concatenate two different strings into single string. How to concatenate two strings into one without using strcat() library function. Adding two strings into one without using inbuilt library function.Concatenation of two strings is the process of joining them together to form a new string. Concatenation basically joins the second string after first string. Concatenation is sometimes also referred as binary addition of strings i.e. + operation.
    For example: Codefor + Win = CodeforWin 
  • CODING ARENA::
  • #include <stdio.h>
    #include<string.h>
    int main()
    {
      char a[100], b[100]; 
      scanf("%s\n%s",a, b); 
      printf("%s\n",a);
      printf("%s\n",b);
      printf("%s%s",a,b);
      
    return 0;
    }
  • Test Case 1

    Input (stdin)
    SRMUniversity
    
    LearningCentre
    
    
    Expected Output
    SRMUniversity
    
    LearningCentre
    
    SRMUniversityLearningCentre
  • Test Case 2

    Input (stdin)
    srmapple
    
    lab
    
    
    Expected Output
    srmapple
    
    lab
    
    srmapplelab

No comments:

Post a Comment