fork download
  1. #include <stdio.h>
  2. int main() {
  3. int n,i,x,count=0;
  4. printf("Enter size: \n");
  5. scanf("%d",&n);
  6. int a[n];
  7. printf("Enter elements: \n");
  8. for(i=0;i<n;i++) scanf("%d",&a[i]);
  9. printf("Enter number to find:\n ");
  10. scanf("%d",&x);
  11. for(i=0;i<n;i++) if(a[i]==x) count++;
  12. printf("Frequency of %d = %d",x,count);
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0.01s 5284KB
stdin
6
10 20 30 10 20 10 
10
stdout
Enter size: 
Enter elements: 
Enter number to find:
 Frequency of 10 = 3