public static void main ( String [ ] args ) {
  Scanner sc = new Scanner ( System . in ) ;
  int a , b , i , j , flag ;
  System . out . printf ( "Enter lower bound of the interval: " ) ;
  a = sc . nextInt ( ) ;
  System . out . printf ( "\nEnter upper bound of the interval: " ) ;
  b = sc . nextInt ( ) ;
  System . out . printf ( "\nPrime numbers between %d and %d are: " , a , b ) ;
  if ( a == 1 ) {
    System . out . println ( a ) ;
    a ++ ;
    if ( b >= 2 ) {
      System . out . println ( a ) ;
      a ++ ;
    }
  }
  if ( a == 2 ) System . out . println ( a ) ;
  if ( a % 2 == 0 ) a ++ ;
  for ( i = a ;
  i <= b ;
  i = i + 2 ) {
    flag = 1 ;
    for ( j = 2 ;
    j * j <= i ;
    ++ j ) {
      if ( i % j == 0 ) {
        flag = 0 ;
        break ;
      }
    }
    if ( flag == 1 ) System . out . println ( i ) ;
  }
}

public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a , b , i , j , flag ; System . out . printf ( " Enter ▁ lower ▁ bound ▁ of ▁ the ▁ interval : ▁ " ) ; a = sc . nextInt ( ) ; System . out . printf ( " \n Enter ▁ upper ▁ bound ▁ of ▁ the ▁ interval : ▁ " ) ; b = sc . nextInt ( ) ; System . out . printf ( " \n Prime ▁ numbers ▁ between ▁ % d ▁ and ▁ % d ▁ are : ▁ " , a , b ) ; if ( a == 1 ) { System . out . println ( a ) ; a ++ ; if ( b >= 2 ) { System . out . println ( a ) ; a ++ ; } } if ( a == 2 ) System . out . println ( a ) ; if ( a % 2 == 0 ) a ++ ; for ( i = a ; i <= b ; i = i + 2 ) { flag = 1 ; for ( j = 2 ; j * j <= i ; ++ j ) { if ( i % j == 0 ) { flag = 0 ; break ; } } if ( flag == 1 ) System . out . println ( i ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal) (identifier) (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (update_expression (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (update_expression (identifier))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (expression_statement (update_expression (identifier)))) (for_statement init: (assignment_expression left: (identifier) right: (identifier)) condition: (binary_expression left: (identifier) right: (identifier)) update: (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) body: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (for_statement init: (assignment_expression left: (identifier) right: (decimal_integer_literal)) condition: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (break_statement))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))))))))