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


Please Help Members By Posting Answers For Below Questions

Write a C program on Centralized OLTP, Decentralized OLTP using locking mechanism, Semaphore using locking mechanism, Shared memory, message queues, channel of communication, sockets and a simple program on Saving bank application program using OLTP in IPC?

2164


What is the purpose of clrscr () printf () and getch ()?

591


explain what is a newline escape sequence?

678


What is typeof in c?

596


What is character constants?

706






How to establish connection with oracle database software from c language?

1669


What is the use of ?: Operator?

660


Explain what is page thrashing?

603


What are the basic data types associated with c?

805


What are the scope of static variables?

596


What is p in text message?

531


Can we increase size of array in c?

534


Is int a keyword in c?

550


Is void a keyword in c?

567


Is it possible to use curly brackets ({}) to enclose single line code in c program?

785