ilian_test

Untitled

Jun 24th, 2021
912
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Problem {
  2.  
  3.     public static void main(String[] args) {
  4.  
  5.         int beta[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
  6.         int min = beta[0];
  7.         for (int i = 1; i < beta.length; i++)
  8.             if (min > beta[i])
  9.                 min = beta[i];
  10.         System.out.println("min=" + min);
  11.        
  12.         int max = beta[0];
  13.         for (int i = 1; i < beta.length; i++)
  14.             if (max < beta[i])
  15.                 max = beta[i];
  16.         System.out.println("max=" + max);
  17.        
  18.         int product_even = 1;
  19.         int counter_even = 0;
  20.        
  21.         for (int i = 0; i < beta.length; i++)
  22.             if (beta[i] % 2 == 0)
  23.                 product_even = product_even * beta[i];
  24.         counter_even++;
  25.  
  26.         System.out.println("product_even=" + product_even);
  27.         System.out.println("counter_even=" + counter_even);
  28.        
  29.         int sum_odd = 0;
  30.         int counter_odd = 0;
  31.        
  32.         for (int i = 0; i < beta.length; i++)
  33.             if (beta[i] % 2 != 0)
  34.                 sum_odd = sum_odd + beta[i];
  35.         counter_odd++;
  36.        
  37.         System.out.println("sum_odd=" + sum_odd);
  38.         System.out.println("counter_odd=" + counter_odd);
  39.     }
  40. }
RAW Paste Data