title: How to find the frequency of a number,without asking the user to enter the input?
body: <p>I'm trying to code a program to find the frequency of a number without asking for the user input.To be clear,I'm looking for an idea where the user doesnot enter the value for which he needs to calculate the frequency,the compiler should default tell the frequency of each number  in the list instead of user giving a number .Below mentioned is my code.</p>
  
  <pre><code> #include &lt;stdio.h&gt;
  #include&lt;conio.h&gt;
  
  float frequency (int theArray [ ], int number, int x)
   {
  int count = 0;
  float mount=0.0;
  float tot = (float)number;
  int u;
  int k;
  float q,h;
  
     //   printf("%d",number);
  
   for (u = 0; u &lt; number; u++)
   {
      if ( theArray[u]==x)
          count++;
   }
    printf ("\nThe frequency of %d in your array is %d ",x,count);
  
  for(k = 0; k&lt; number; k++)
  {
      if(theArray[k]==x)
  
             //count(theArray[k])         
      {       mount++;
  
      }
    }
    if(mount&gt;1)
      {
  
  
      q = mount/tot;
  
  
      return q;
  
      }
     else
    {
  
  
     h = mount/tot;
  
      return h;
      }
    } 
  
  
   void main()
     {
     FILE*file = fopen("num.txt","r");
     int integers[100];
     int theArray[100];
     int i=0;
     float e;
     int num;
     int x,k;
     while(fscanf(file,"%d",&amp;num)&gt;0)
     {
      integers[i]=num;
      printf("\n%d",integers[i]);
      i++;
      }
  
   printf ("\n OK, Thanks! Now What Number Do You Want To Search For Frequency In Your Array? ");
   scanf(" %d", &amp;x);/*Stores Number To Search For Frequency*/
   e =  frequency(integers,i,x); 
  printf("\n probability of %d is %f",x,e);
  getch();
  fclose(file);
       }
  </code></pre>
  
  <p>so my  output as of now is:
     1)  The list of numbers
     2)The frequency of the number occurence
     3)Probability of my number
    instead i'm looking for something that gives the probability and frequency of my number without any<br>
    user input. i.e I'm looking for something like</p>
  
  <p>Output:
    Frequency of this number is ---- and it's probability is--------- </p>
  
  <p>Any help would be highly appreciated.</p>