dimanche 16 octobre 2016

PLEASE HELP numbers between 1 and 20 java

Write a Java program that does the following:

  1. Generates 5 random numbers between 1 and 20 (each random number needs to be shown in the output).
  2. Sum the 5 random numbers and display the sum.
  3. Determines if the sum is a prime number.

The program should have this output (below is an example): The five random numbers are: , , , , and
The sum of the five random number is: The sum is / is not a prime number

I am really having trouble understanding how to write this. I figured out how to determine if a number is prime, but how do I generate the numbers and add them together?




Aucun commentaire:

Enregistrer un commentaire