write a program to find the frequency of a number
Answer Posted / vikky_manit
#include<stdio.h>
void main()
{
int a[10],n,key,count=0;
printf("Enter the number of elements\n");
scanf("%d",&n);
printf("Enter %d elements\n",n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
printf("Enter the element whose frequency is to be
determined\n");
scanf("%d",key);
for(i=0;i<n;i++)
if(key==a[i])
count++;
printf("Frequency=%d",count);
}
| Is This Answer Correct ? | 39 Yes | 36 No |
Post New Answer View All Answers
What is the use of #include in c?
Define Array of pointers.
Explain what is a stream?
Why is it usually a bad idea to use gets()? Suggest a workaround.
There seem to be a few missing operators ..
Can include files be nested?
Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?
Why can't I perform arithmetic on a void* pointer?
How would you obtain the current time and difference between two times?
What is meant by preprocessor in c?
List some of the static data structures in C?
pierrot's divisor program using c or c++ code
Why shouldn’t I start variable names with underscores?
program to convert a integer to string in c language'
a construct the"else" part of "if" statement contains anoth "if else" statement is called a) if-else b) else-if-else c) if-else-if-else d) chain if/if-else-if