142. Program to check if a given character is present or not in a sting.
#include<stdio.h>
char ch[10],i;
void main()
{
printf("Enter a string : ");
scanf("%s",ch);
for(i=0;ch[i];i++)
{
if(ch[i]=='a')
{
printf("Character is present\n");
break;
}
}
if(ch[i]=='\0')
printf("Character is not present");
}
Comments
Post a Comment