Yuvalxp8

Table for While loop

Jan 28th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.29 KB | None | 0 0
  1. import java.util.*;
  2. public class p180ex6
  3. {
  4.    
  5.     static Scanner in= new Scanner(System.in);
  6.     public static void main(String[] args)
  7.     {
  8.         int counter = 0;
  9.         int a = 0;
  10.             while(a >= 0)
  11.             {
  12.                 a = in.nextInt();
  13.                 if(a>0)
  14.                 counter ++;
  15.             }
  16.         System.out.println(counter);
  17.     }
  18.  
  19. }
Add Comment
Please, Sign In to add comment