Advertisement
Shavit

Twenty Numbers V2

Oct 27th, 2013
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.41 KB | None | 0 0
  1. // Shavit Borisov
  2. // CW
  3.  
  4. import java.util.Scanner;
  5.  
  6. public class TwentyNumbersV2 {
  7.  
  8.     public static void main(String[] args)
  9.    
  10.     {
  11.         Scanner in = new Scanner (System.in);
  12.        
  13.         int num, sum;
  14.        
  15.         System.out.println("Enter 2 digit numbers:");
  16.        
  17.         for(;;)
  18.         {
  19.             num = in.nextInt();
  20.             if(num==-1)
  21.                 break;
  22.             sum = num%10 + num/10;
  23.             System.out.printf("%d ", sum);
  24.         }
  25.        
  26.         in.close();
  27.     }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement