title: adding using file integers input
body: <p>so i got the whole setup for my program and i was able to read the whole file content. the only one thing i need is to be able to add each column and put it in the variables i made. first column is miles second is gallons. so how can i make it possible using my code.      </p>
  
  <p>54 250 19</p>
  
  <p>62 525 38</p>
  
  <p>71 123 6</p>
  
  <p>85 1322 86</p>
  
  <p>97 235 14</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;conio.h&gt;
  
  int main()
  {
      // pointer file
      FILE *pFile;
      char line[128];
      int miles;
      int gallons;
      int mpg;
  
      // opening name of file with mode
      pFile = fopen("Carpgm.txt","r");
  
      //headers
      printf("Car No.  Miles Driven    Gallons Used\n");
      //checking if file is real and got right path
      if (pFile != NULL)
      {
  
          while (fgets(line, sizeof(line), pFile) != NULL)
          {
              int a, b, c;
  
              if (sscanf(line, "%d %d %d", &amp;a, &amp;b, &amp;c) == 3)
              {
                  /* Values read */
                  printf("%d        %d             %d\n",a, b, c);
  
  
              }
  
  
          }
          mpg = miles / gallons;
          printf("Total miles driven: \n",miles);
          printf("Total Gallons of gas: \n",gallons);
          printf("Average MPG: \n",mpg);
  
          printf("%d",a);
  
          //closing file
          fclose(pFile);        
      }
      else 
      {
          printf("Could not open file\n");     
  
      }
  
      getch();
      return 0;
  }
  </code></pre>