Computer Science, asked by pradeepgmailcom59161, 1 year ago

C program to compare two strings and delwte the common letters

Answers

Answered by gurukulamdivya
1

Here is your Answer:

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

 

int main()

{

char str1[80], str2[80];

int megethos1, megethos2,max,i,j;

   printf ("Give first string: ");

   scanf ("%s", &str1);

   printf ("Give second string: ");

   scanf ("%s", &str2);

 

   size1= strlen(str1);

   size2= strlen(str2);

 

   for (j=0; j<size2; j++){

          for (i=0; i<size1; i++){

                 if (str1[i]==str2[j])

                     str1[i]=' ';

         }

   }

   printf ("%s", str1);

 

   system("pause");

 

}

Similar questions