ZOHO INTERVIEW QUESTION
QUESTION:
Given two Strings s1 and s2, remove all the characters from s1 which is present in s2.
Input: s1=”expErIence”, s2=”En”
output: s1=”exprIece"
output: s1=”exprIece"
ANSWER:
#include<stdio.h>
#include<stdlib.h>
int main()
{
char a[100],b[100];
int i,j;
scanf("%s %s",a,b);
for(i=0;i<strlen(a);i++)
{
for(j=0;j<strlen(b);j++)
{
if(a[i]==b[j])
break;
if(a[i]!=b[j] && j==strlen(b)-1)
printf("%c",a[i]);
}
}
}
Comments
Post a Comment