title: Histogram from -5 to 5 in C
body: <p>so basically I have an assignment to change my previous code that I wrote that generates and prints out the histogram (mine does 0 to 10) from 30 element board. I can't seem to make it do -5 to 5 so I'd want it to -5 every number it generates before printing it out. I've been thinking for 2 days already and I can't seem to find the soludion. I'm attaching the raw code. I'm new to C.</p>
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  #include&lt;time.h&gt;
  #include&lt;math.h&gt;
  #define TABLE_SIZE 30
  #define HISTOGRAM_SIZE 11
  
  int tablica[TABLE_SIZE];
  int histogram[HISTOGRAM_SIZE];
  
  
  void wylosuj_tablice() //generate an array
  {
      int i;
      srand(time(0));
      for(i=0;i&lt;TABLE_SIZE;i++)
      {
          tablica[i]=(rand()%HISTOGRAM_SIZE);
      }
  }
  
  void czysc_histogram() //clean histogram
  {
      int i;
      for(i=0; i&lt;HISTOGRAM_SIZE; i++) {
          histogram[i] = 0;
      }
  }
  
  void tworz_histogram() //basically now it does 0 to 10 but I want it to -5 to 5, so every int would be -5
  {
      int i;
      czysc_histogram();
      for(i=0; i&lt;TABLE_SIZE; i++) {
          histogram[tablica[i]]++;
      }
  
  }
  
  void wyswietl_histogram() // print the histogram
  {
  {
      int i;
      for(i=0; i&lt;HISTOGRAM_SIZE; i++) {
          printf(&quot;Liczba %d: %d\n&quot;, i, histogram[i]);
      }
  }
  }
  void wyswietl_tablice() //Print a sorted table
  {
      int i;
      for(i=0; i&lt;TABLE_SIZE; i++) {
          printf (&quot;tablica[%d]=%d\n&quot;, i, tablica[i]);
      }
  }
  
  int main()
  {
      wylosuj_tablice();
      wyswietl_tablice();
      tworz_histogram();
      wyswietl_histogram();
      return 0;
  }
  </code></pre>