Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package create_array_100;
- import java.util.Random;
- public class array {
- final static Random random = new Random();
- public static void main(String[] args){
- int a[] = new int [100];
- String str ="";
- for (int i=0; i<100; i++)
- {
- a[i] = random.nextInt(50);
- str+= a[i] + " ";
- }
- System.out.println ("наш массив: " + str);
- String strch = a[0] + " ";
- int res = a[0];
- for(int i=2; i<100; i++)
- {
- strch+=a[i]+ " ";
- res= res*a[i];
- i++;
- }
- System.out.println ("четные: " + strch);
- System.out.println ("произведение четных: " + res);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment