write the function. if all the character in string B appear in
string A, return true, otherwise return false.

Answer Posted / sravanthi

#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
int main()
{
char *a;
a=(char*)malloc(20*sizeof(char));
char *b;
b=(char*)malloc(20*sizeof(char));
int i,j,flag,count,n;
i=j=count=flag=0;
printf("enter the string 1");
gets(a);
printf("enter the string 2");
gets(b);
n=strlen(b);
while(b[j]!='\0')
{
i=0;
flag=0;
while(a[i]!='\0')
{
if(a[i]==b[j])
{
flag=1;
break;
}
else
{
i++;
}
}

if(flag==1)
{
count=count+1;
}
j++;
}
if(count==n)
{
printf("true");

}
else
{
printf("false");
}
getch();
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how to test pierrot divisor

2264


Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange

2867


What is full form of PEPSI

1872


What is the match merge ? compare data step match merge with proc sql merge - how many types are there ? data step vs proc sql

2414


What is data _null_? ,Explain with code when u need to use it in data step programming ?

2828






Hi, i have a project that the teacher want a pyramid of numbers in C# or java...when we click a button...the pyramid should be generated in a listbox/or JtextArea...and the pyramid should have the folowing form: 1 232 34543 4567654 567898765 67890109876 7890123210987 890123454321098 90123456765432109 0123456789876543210 Plz help with codes...didn't find anything on the net.

2692


write a c program to input initial & final time in the format hh:mm and find the time intervel between them? Ex inputs are initial 06:30 final 00:05 and 23:22 final 22.30

2228


Set up procedure for generating a wire frame display of a polyhedron with the hidden edges of the object drawn with dashed lines

3032


Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?

3857


How do you verify if the two sentences/phrases input is an anagram using predefined functions in string.h and by using arrays?

2029


write a simple calculator c program to perform addition, subtraction, mul and div.

3155


how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.

2145


To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']

506


how to create a 3x3 two dimensional array that will give you the sums on the left and bottom columns

3129


Write a program to model an exploding firecracker in the xy plane using a particle system

3697