input and add

  1. package firstjava;
  2. import java.util.Scanner;
  3. public class Max {
  4.  
  5.     public  static int max(int iFint iS ){
  6.         if ( iF > iS)
  7.             return iF;
  8.         else if ( iF < iS )
  9.             return iS;
  10.         else
  11.             return 0;
  12.        
  13.     }
  14.     public static void main(String[] args) {
  15.         // TODO Auto-generated method stub
  16.         Scanner input = new Scanner(System.in);
  17.         boolean Flag = true;
  18.         while (Flag)
  19.             {
  20.             // input number
  21.             int i = input.nextInt();
  22.             int j = input.nextInt();   
  23.             if (== 0)
  24.                 break;
  25.             int k;
  26.             k = max(i, j);
  27.             if ( k==0 )
  28.                 System.out.println("Equal");
  29.             else
  30.                 System.out.println("The bigger one is " + k );
  31.             }
  32.     }
  33.  
  34. }

留言

這個網誌中的熱門文章

Codeforces --- string task

Uva 674 ---- coin change

codeforces 271A --- beautiful year