Advertisement
Guest User

Untitled

a guest
Dec 10th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. //*******************************************************************
  2. // NOTE: please read the 'More Info' tab to the right for shortcuts.
  3. //*******************************************************************
  4. import java.util.*;
  5.  
  6. public class Prog {
  7.     public static void main(String args[]){
  8.         Scanner scanner = new Scanner(System.in);
  9.        
  10.         while(true){
  11.             System.out.println("wprowadz wart calkowita: ");
  12.             if(scanner.hasNextInt()){
  13.                 int value = scanner.nextInt();
  14.                 if(value <= 100 && value >= 0){
  15.                     System.out.println(value + " * 2 = " + value * 2);
  16.                     break;
  17.                 }
  18.                 System.out.println("wartosc poza zakresem");
  19.             } else {
  20.                 System.out.println("'" + scanner.next() + "' to nie jest wart. calkowita");
  21.             }
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement