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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is output redirection?

882


How can you avoid including a header more than once?

737


Explain what are header files and explain what are its uses in c programming?

859


How do shell structures work?

782


What is typedef example?

835


What is the difference between class and object in c?

805


Explain how do you declare an array that will hold more than 64kb of data?

1149


Is array a primitive data type in c?

784


Whats s or c mean?

766


The program will first compute the tax you owe based on your income. User is prompted to enter income. Program will compute the total amount of tax owed based on the following: Income Tax 0 - $45,000 = 0.15 x income $45,001 - $90,000 = 6750 + 0.20 x (income – 45000) $90,001 - $140,000 = 15750 + 0.26 x (income – 90000) $140,001 - $200,000 = 28750 + 0.29 x (income – 140000) Greater than $200,000 = 46150 + 0.33 x (income – 200000) Dollar amounts should be in dollars and cents (float point numbers with two decimals shown). Tax is displayed on the screen.

1275


What is the general form of #line preprocessor?

760


Can we compile a program without main() function?

857


Explain what is output redirection?

866


what is the c source code for the below output? 5555555555 4444 4444 333 333 22 22 1 1 22 22 333 333 4444 4444 5555555555

2784


What does c value mean?

852