0

What is wrong in the following program?

public class PrimeCheck { public static void main(String[] args) { Scannerin=newScanner(System.in); int n,i,c=0; System.out.println("Enter a number:"); n=in.nextInt(); for (i=1; i<=n; i++) { if(n%i==0) c++; } if(c==2) { System.out.println("A Prime Number!"); } else { System.out.println("Not a Prime Number!"); } } }

27th Aug 2019, 4:52 PM
Druvika
4 Réponses
+ 12
Scannerin = new Scanner(System.in); Replace with Scanner in = new Scanner(System.in); And you done
27th Aug 2019, 6:40 PM
Sumit Programmer😎😎
Sumit Programmer😎😎 - avatar
0
what error do you get?
27th Aug 2019, 4:55 PM
Cat Sauce
Cat Sauce - avatar
0
import java.util.Scanner; public class PrimeCheck // ... Scanner in = new Scanner(System.in); //add two spaces
27th Aug 2019, 10:29 PM
zemiak
0
give space in the scanner line between scanner and in
28th Aug 2019, 8:58 AM
H.saikiran