how do i write java loop program where the user enters 10 random numbers. the program then collects the prime numbers from that 10 random numbers and adds all the prime numbers and prints the sum of the prime numbers. if the number 13 is entered, the loop stops.

1 answer

I assume you can write a loop and get input.
sum=0
start loop...
get input n
if n==13 break;
if prime(n) sum += n
end loop...
print sum

now: how to test for a prime value?
A simple example for this can be found at

https://www.programmingsimplified.com/java/source-code/java-program-print-prime-numbers

You will find that google is very useful for turning up java code for almost anything you want to do.