write a program to find the frequency of a number
Answer Posted / veeraj.j
#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 ? | 11 Yes | 16 No |
Post New Answer View All Answers
What standard functions are available to manipulate strings?
How can I recover the file name given an open stream?
What oops means?
Why dont c comments nest?
what is the format specifier for printing a pointer value?
What Is The Difference Between Null And Void Pointer?
What does a pointer variable always consist of?
What is getch() function?
What is context in c?
stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.
List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.
Define recursion in c.
Can math operations be performed on a void pointer?
What is indirection in c?
What is pointer and structure in c?