-1

I've been searching, and nothing helped with my problem so far. My goal is to rewrite a for loop to a while loop, and prime the while loop. I've done this so far

  int i = -1;
  while (i <= 10);
  { 
     i = i + 1;
     System.out.println("i=" + i);
  }

The program keeps running, but doesn't print out anything. I think it has to do with my i value, but I've tried everything I could think off T.T

Tina Ditte
  • 11
  • 1
  • 4

1 Answers1

1

Remove the semicolon at while end

int i = -1;
  while (i <= 10)
  { 
     i = i + 1;
     System.out.println("i=" + i);
  }