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


Please Help Members By Posting Answers For Below Questions

Write an efficient algo and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.

653


Explain what is the benefit of using const for declaring constants?

606


Given below are three different ways to print the character for ASCII code 88. Which is the correct way1) char c = 88; cout << c << " ";2) cout.put(88);3) cout << char(88) << " "; a) 1 b) 2 c) 3 d) constant

662


What is the sizeof () a pointer?

543


Describe explain how arrays can be passed to a user defined function

597






find the sum of two matrices and WAP for it.

626


How can I read in an object file and jump to locations in it?

567


Are the variables argc and argv are local to main?

780


What is c variable?

547


Difference between MAC vs. IP Addressing

632


What are all different types of pointers in c?

568


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

606


What is hashing in c?

638


What is the sizeof () operator?

614


program for reversing a selected line word by word when multiple lines are given without using strrev

1937