How can I write a while loop to output the integer values from 0 up to n exclusive.
The output should have five values per line, with values separated by a space. I can do it on the same line but, I am confused about the five values per line. Where am I supposed to add while loop to do it?
import java.util.Scanner;
public class While
{
   public static void main( String[] args)
   {
      Scanner scan = new Scanner( System.in);
      // constants
      // variables
      int n;
      int value;
      // program code
      value = 0;
      System.out.println( "Enter an integer ");
      n = scan.nextInt();
      if( n <=0){
         System.out.println( "Error");
      }else
         while ( value < n){
         System.out.print( value + " ");
         value = value + 1;
      }
   }
}
 
     
     
     
    