title: Is there a way to handle spaces during output in table form for C lang?
body: <p>This is my code and here I'm unable to manage the spaces in the header in my output when I was converting in table form.
  Here is what I did :</p>
  <pre><code>#include &lt;stdio.h&gt;
  
  int main()
  {
      int n;
      printf(&quot;Enter no of students : &quot;);
      scanf(&quot;%d&quot;,&amp;n);
      int marks1[n], marks2[n],rollno[n];
      float avg=0, total=0;
      char name[5][10];
      char grade;
  
      for(int i=0; i&lt;n; i++) {
          printf(&quot;Enter name %d : &quot;,(i+1));
          scanf(&quot;%s&quot;,name[i]);
          printf(&quot;Enter roll no  : &quot;);
          scanf(&quot;%d&quot;,&amp;rollno[i]);
          printf(&quot;Enter Marks1 of student %d : &quot;,(i+1));
          scanf(&quot;%d&quot;,&amp;marks1[i]);
          printf(&quot;Enter marks2 of student %d : &quot;,(i+1));
          scanf(&quot;%d&quot;,&amp;marks2[i]);
      }
      
      printf(&quot;\n                                          Student Records                                               \n&quot;);
      printf(&quot;Name \t Roll No \t       Marks1 \t          Marks2 \t    Total \t   Avg \t Grade \n&quot;);
      for(int i=0; i &lt; n; i++) {
          total = marks1[i] + marks2[i];
          avg = (marks1[i] + marks2[i])/2;
          if(avg &gt;= 85) { 
              grade = 'S'; 
          } else if (avg &gt;=70 &amp;&amp; avg &lt; 85) { 
              grade = 'A'; 
          } else if (avg &lt; 70 &amp;&amp; avg&gt;=60) {
              grade = 'B';
          } else if (avg &gt;= 50 &amp;&amp; avg &lt; 60) {
              grade = 'C';
          }  else {
              grade = 'F';
          }
          printf(&quot;%-8s | %-14d | %-14d | %-9d | %-7.2f | %-8.2f | %-7c\n&quot;, name[i], rollno[i], marks1[i], marks2[i], total, avg, grade);
          avg=0;
          total=0;
      }
  
      return 0;
  }
  </code></pre>
  <hr />
  <p>Output:</p>
  <pre><code>Enter no of students : 1
  Enter name 1 : raju
  Enter roll no  : 22
  Enter Marks1 of student 1 : 78
  Enter marks2 of student 1 : 98
  
                                            Student Records                                               
  Name     Roll No           Marks1             Marks2        Total      Avg   Grade 
  raju     | 22             | 78             | 98        | 176.00  | 88.00    | S      
  </code></pre>
  <p>Is there any method to handle the spaces during Input ?</p>