The question is....

Write a program that, given an integer input, can display whether the input is a prime number or not. To do this, you must define a method named isPrime that receives an integer as its parameter and will return true if the integer is a prime number. Otherwise, it will return false. Your program will then call this method for the displaying purpose.

This is my code...

import java.util.Scanner;

public class main1 {

public static void main(String[] args) {

Scanner abc;

abc = new Scanner (System.in);

int input;

int divide = 2;

int count=0;

System.out.println("Please enter an interger to determine if it is prime");

input = abc.nextInt();

for (int x=1; x < input; x++) {

if ((input%divide) == 0)

count += 1;

divide = divide + 1;

}

if (count == 0)

System.out.println("It is a prime number");

else

System.out.println("It is not a prime number");

}

}

but the question if different with my answer right?

SO what should i write for this question...

In JGRASP !! not C or C++ ..

THANKS !!!!!!