Computer Science, asked by varsha6371513, 1 month ago

write a java program to print all the prime number in an array of n elements​

Answers

Answered by Shreya762133
1
  • Prime number is the number that is only divisible by 1 and the number itself. If the number leaves remainder 0 when divided by numbers other than 1 and the number itself then, the number is not said to be a prime number. To print the prime numbers from an array, user has to declare the size of the array size and enter the elements of the array. Prime numbers are identified using iterations with the help of for loop and condition for prime number is specified using if statement. Then the numbers that satisfy the condition i.e, prime numbers are displayed on the screen as output.

*Find attached Image for java program

HOPE SO IT HELPS YOU

Attachments:
Similar questions