title: How can I display the line number for a printf statement in c?
body: <pre><code>int main() {
  int i, repeatName; // ints
  char firstName[50]; // array to store users name
  
  // get first name from user
  printf("Please enter your first name: ");
  scanf("%s", firstName);
  
  // get amount of times user would like to repeat name
  printf("How many times would you like to repeat your name?: ");
  scanf("%i", &amp;repeatName);
  
  // tell user name has to be repeated at last one
  if (repeatName &lt; 1) {
      printf("The name has to be repeated at least one (1) time. Try again: ");
      scanf("%i", &amp;repeatName);
  }
  
  // for loop to repeat name 'x' number of times
  for (i = 0; i &lt; repeatName; i++) {
      printf("%s \n", firstName);
  }
  }
  </code></pre>
  
  <p>For example: If the user wanted to display their name 3 times it would say:</p>
  
  <pre class="lang-none prettyprint-override"><code>Your name 
  
  Your name
  
  Your name 
  </code></pre>
  
  <p>How can I get it to say:</p>
  
  <pre class="lang-none prettyprint-override"><code>Line 1 Your name
  
  Line 2 Your name
  
  Line 3 Your name 
  </code></pre>