A
A
Alexander2017-01-08 23:06:22
Java
Alexander, 2017-01-08 23:06:22

The program does not compile in Eclipse, although it does not give any errors. What is the reason?

Hello everyone) I want to warn you in advance that I'm learning programming for the first month, so maybe the question is stupid, but still:
The program should determine whether the number entered by the user is prime or not.
The problem is that Eclipse does not show errors and I'm already scratching my head here, everything is logically wrong or some other problem.
Here is my program:
import java.util.Scanner;
public class Zadacha9 {
public static void main(String agrg[]){
Scanner scn = new Scanner(System.in);
scn hasNextInt();
int n = scn.nextInt();
for(int i=2; i>=Math.sqrt(n) && i<=(n-1); i++){
if(n%i!=0){
System .out.println("Not easy") ;
}
else{
System .out.println("Easy");
}
}
}
}
Thanks in advance)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
Cyril, 2017-01-09
@argz

What does "does not compile" mean?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question