Please help me, its emergency!!!

The 10 numbers will be collected from the keypad using a loop. If the number entered is a prime only, that number will be added. How do I write a Java program to input 10 prime numbers and print the sum?

1 answer

I expect you know how to build a loop reading input values.
The question is, how to find the primes.
All you have to do is test to see whether the number has any factors less than its square root (since the other factor will be greater)

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.