title: Java - Incrementing Numbers using for loop
body: <p>I have attempted to complete the following exercise however the output isn't as expected. </p>
  
  <p>You should print a number of pluses equal to the number entered by the user, followed by a list of numbers, so that in total exactly 20 characters are printed. The numbers printed should be the last digit of the current position in the list. Example: +++++678901234567890 if the number entered by the user was 5.</p>
  
  <p>Here's my code: </p>
  
  <pre><code>package interact;
  
  import java.util.Scanner;
  
  public class Interact {
  
  
      public static void main(String[] args) {
  
  
  
          Scanner scanner = new Scanner (System.in);
  
              {int value,k
              for (int i=0; i&lt;num1; i++) {
                  System.out.print("+");}
  
  
                          for (int j=0; j&lt;20-num1; j++) {
  
                              if (num1&gt;9) {k=num1-10;}
  
                              else k=num1+1;
                              System.out.print(k);
  
                  }
  
  }
  </code></pre>
  
  <p>The output if 6 is entered is ++++++77777777777777. The numbers aren't incrementing - why not? </p>