Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Find occurence of a character in a sting.

Answer Posted / anil kumar nahak

void main()
{
char *st,ch;
int i=0,c=0;
printf("\n Enter The String: ");
gets(st);
printf("\n Enter A character For finding occurance: ");
scanf("%c",&ch);

while(st[i]!='\0')
{
if(st[i]==ch)
c++;
i++;
}
printf("\n %c Present In The String %d Times",ch,c);

}

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what is a const pointer?

1035


What is calloc in c?

1079


What is difference between structure and union?

1078


Explain how can I convert a number to a string?

1099


Write a code to remove duplicates in a string.

983


write a program to copy the string using switch case?

2842


which is conditional construct a) if statement b) switch statement c) while/for d) goto

1165


What is void main () in c?

1151


What is the use of clrscr?

1053


What is && in c programming?

1111


disply the following menu 1.Disply 2.Copy 3.Append; as per the menu do the file operations 4.Exit

2017


what is the role you expect in software industry?

2085


Explain what are preprocessor directives?

1014


Can include files be nested? How many levels deep can include files be nested?

1087


Explain how can you tell whether a program was compiled using c versus c++?

1053