C PROGRAM
#include<stdio.h>
#define SIZE 50
int main()
{
char input[SIZE];
char *p,c;
int flag = 0;
printf("\nEnter any String : ");
fgets(input,SIZE,stdin);
printf("\nEnter a character you want to find in string: ");
scanf("%c",&c);
p = input;
while(*p != '\0')
{
if (*p == c)
{
flag = 1;
break;
}
p++;
}
if (flag == 1)
{
printf("\n<-- Character you entered is FOUND in given string.-->");
}
else
{
printf("\n<-- Character you entered is NOT FOUND in given string.-->");
}
return 0;
}
0 Comments