#please help

1 messages · Page 1 of 1 (latest)

edgy latchBOT
#

<@&987246399047479336> please have a look, thanks.

onyx berry
#

public class ForLoops {
   public static void main (String [] args) {
      int firstNumber;
      int i;
      
      Scanner input = new Scanner(System.in);
      firstNumber = input.nextInt();

      System.out.println("Ready!");
      
      for (i = firstNumber; i >= 1; i--) {
         System.out.println(firstNumber);
      }
      
      System.out.println("Blastoff!");

   }
}
edgy latchBOT
# onyx berry ``` java import java.util.Scanner; public class ForLoops { public static voi...

Detected code, here are some useful tools:

Formatted code
javaimport java.util.Scanner;

public class ForLoops {
  public static void main(String[] args) {
    int firstNumber;
    int i;
    Scanner input = new Scanner(System.in);
    firstNumber = input.nextInt();
    System.out.println("Ready!");
    for (i = firstNumber; i >= 1; i--) {
      System.out.println(firstNumber);
    }
    System.out.println("Blastoff!");
  }
}
onyx berry
#

idk why the output is 333

nimble flume
#

You need to use i in your output.

onyx berry
#

instead of 321

#

oh

#

but why didnt firstNumber work?

nimble flume
#

Because you're decrementing i, not first number.

onyx berry
#

oh i see

#

thats why

#

thank you so much Simon!

nimble flume
#

You're welcome.