Advertisement
Alex_Zuev

Untitled

Feb 26th, 2015
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. Enter your code herepackage com.company;
  2. import java.util.Arrays;
  3.  
  4. /**
  5.  * Created by Alex on 26.02.2015.
  6.  */
  7. public class Massive {
  8.  
  9.     public static void main(String[] args) {
  10.         int m[] = new int[12];
  11. int mMax=0;
  12.         int iMax=0;
  13.         for (int i = 0; i < m.length; i++) {
  14.             m[i] = ((int) ((Math.random() * 32) - 16));
  15.             if (m[i]>mMax){
  16.                 mMax=m[i];
  17.                 iMax=i;
  18.             }
  19.  
  20.  
  21.         }
  22.         for (int i = 0; i < m.length; i++) {
  23.             System.out.print(m[i] + " ");
  24.         }
  25.         System.out.println();
  26.         System.out.println("ММаксимальный элемент="+mMax+"индкс в массиве ="+iMax);
  27.     }
  28.  
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement