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

why division operator not work in case of float constant?

2 Answers  


a program that can input number of records and can view it again the record

0 Answers   Accenture,


Explain what is dynamic data structure?

0 Answers  


How can I write functions that take a variable number of arguments?

0 Answers  


write a program to swap Two numbers without using temp variable.

75 Answers   EMC, Focus, GreyB, HCL, Hitech, HP, Huawei, Infosys, Mannar Company, Microsoft, Miles Software, Odessa Technologies, Satyam, TCS, Wipro,






What is double pointer in c?

0 Answers  


Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.

0 Answers  


Consider the following C program. #include <stdio.h> int main() { int i; for (i=0;i<3;++i) { fork();fork(); } } How many processes are created when running this program (including the initial one)? Explain

2 Answers  


In C, What is the #line used for?

2 Answers  


What is C++

4 Answers  


Why can’t constant values be used to define an array’s initial size?

0 Answers  


Explain what is the difference between a string and an array?

0 Answers  


Categories