Advertisement
apez1

Term 1: Lesson 24 - Coding Activity 3

Oct 5th, 2018
465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Lesson_24_Activity_Three {
  4.  
  5.     public static void main(String[] args) {
  6.        
  7.        
  8.     Scanner scanner = new Scanner(System.in);
  9.    
  10.     System.out.println("Enter a number between 0 and 100:");
  11.     int input = scanner.nextInt();
  12.     int flag = 0;
  13.     int c = 0;
  14.  
  15.    
  16.     if(input < 0 || input > 100) {
  17.         System.out.println("error");
  18.         flag = 1;
  19.     }
  20.     else {
  21.        
  22.         for(int i = input; i <= 100; i++) {
  23.             System.out.print(i + " ");
  24.            
  25.             if(i%20 == 9) {
  26.                 System.out.println('\n');
  27.    
  28.             }
  29.            
  30.            
  31.         }
  32.        
  33.        
  34.        
  35.            
  36.            
  37.            
  38.              
  39.            
  40.         }
  41.        
  42.        
  43.        
  44.        
  45.        
  46.     }
  47.    
  48.    
  49.    
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement