write a programe returns the number of times the character
appears in the string

Answers were Sorted based on User's Feedback



write a programe returns the number of times the character appears in the string..

Answer / mohanraj

if(a[i]==q)

Is This Answer Correct ?    2 Yes 0 No

write a programe returns the number of times the character appears in the string..

Answer / vignesh1988i

#include<stdio.h>
#include<conio.h>
void main()
{
char a[50],q;
int count =0;
printf("enter the sring :");
gets(a);
printf("enter the char. to be searched :");
scanf("%c",&q);
for(int i=0;a[i]!='\0';i++)
{
if(a[i]==f)
count++;
}
printf("the occurance is :%d",count);
getch();
}

Is This Answer Correct ?    3 Yes 4 No

Post New Answer

More C Interview Questions

write a C code to reverse a string using a recursive function, without swapping or using an extra memory.

9 Answers   Motorola, TCS, Wipro,


How is = symbol different from == symbol in c programming?

0 Answers  


In how much time you will write this c program? Prime nos from 1 to 1000

2 Answers   TCS,


What does 4d mean in c?

0 Answers  


Compare interpreters and compilers.

0 Answers  






program that accepts amount in figures and print that in words

2 Answers   Infosys, Lovely Professional University, Wipro,


How to implement variable argument functions ?

1 Answers   HP,


What is clrscr in c?

0 Answers  


Why is c still so popular?

0 Answers  


please help me..... please codes and flowchart plz turbo c lang po yan.....please asap response... 3. Make an astrology program. The user types in his or her birthday (month, day, and year as integer), and the program responds with the user’s zodiac sign, horoscope, and other information related to it. If the user’s birth year falls into a leap year, your program should display an appropriate message for it. NOTES: Conditional Statements: it should be with graphics

0 Answers  


How are structure passing and returning implemented?

0 Answers  


What is the difference between variable declaration and variable definition in c?

0 Answers  


Categories