mercredi 20 mai 2020

How to pick out and multiply odd numbers with each other

I'm very beginner at Java. My task is to generate twenty random numbers from 60 to 84 and to pick out and multiply only odd numbers and display it. Right now I'm only able to generate the numbers:

public class Main
{
    public static void main(String[] args) { 
        int[] n = new int[20]; 
        Random rnd = new Random (); 
        for (int i = 0; i < 20; i++) { 
            n[i]=rnd.nextInt(84 - 60 + 1) + 60;
            System.out.print (n[i]+" : "); 
        } 

    }
}



Aucun commentaire:

Enregistrer un commentaire