38.0k views
0 votes
Input an int between 0 and 100 and print the numbers between it and 100, including the number itself and the number 100. If the number is less than or equal to 0, or greater than or equal to 100 print "error". Print 20 numbers per line.

User Syr
by
5.0k points

1 Answer

1 vote

Answer:

Concept: Programming

See the solution below:

import java.util.Scanner;

import java.lang.Math;

class Lesson_24_Activity_Three {

public static void main(String[] args){

Scanner scan = new Scanner(System.in); System.out.println ("Enter a number between 0 and 100:");

int x = scan.nextInt();

if ( x <= 0 || x >= 100) { System.out.println("error");

}

else

{

for (int i = x; i <= 100; i ++)

{

System.out.print( i + " ");

}

}

}

}

User Wjdp
by
6.0k points