0
Write a program to input the number and check the number weather it is prime or not
A number is said to be prime if it is divisible by 1 and itself
4 Réponses
+ 4
Take a look👀
https://code.sololearn.com/c4EwHLtsTzIH/?ref=app
+ 2
Can you show us you attempt ? Also, don't forget to include your programming language in the tags.
+ 1
See this code
https://www.programiz.com/c-programming/examples/prime-number
Read and try write your code.
0
//in Java
Public void searchPrim(int number) {
//2, because 1 is always true
Int i =2
while (i<= number && number % i != 0)
{
i++;
}
if (number == i)
{
System.out.println("Prime!")
}
else
{
System.out.println(number +"has smallest divisor" +i) ;
}