title: how to print the number of times code looped?
body: <p>i have wrote a simple code that prints all the prime numbers from the number that has entered. I would like to print how many prime numbers are printed. I think its print("%d",c++); but i dont know where to put it. I have tried putting it right before return 0; at the end of prime method but it does not work. The prime numbers print just fine but the counter does not print. </p>
  
  <pre><code>    void main(void){
          int pri;
          scan("%d",&amp;pri);
          prime(pri);    
      }
  
      void prime(int n){
          int m,i,c,x;
  
          for(m = 1;m&lt;=n;m++){
              c = 0;
              for(i=2;i&lt;=m/2;i++){
                  if(m%i==0){
                      c++;
                      break;
                  }
              }
  
              if(c==0 &amp;&amp; m!= 1){
                  printf("%d ",m);
              }          
          }  
          print("the count is: ");              
          print("%d",c);        
          return 0;
  
  
      }  
  </code></pre>
  
  <p>If I input 100 I want the output to be:</p>
  
  <pre><code> 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 
   61 67 71 73 79 83 89 97
   The count is 25. 
  </code></pre>