Optimsed " prime number "

Table of contents

No heading

No headings in the article.

Prime Number : A Whole Numer (any number between zero to infinity, not 
              including decimals or fractions  eg:1,2,...∞ )  that  has 
              factors only 1 and itself.

// JAVA code 
Prerequestis : If you have an idea of how to code for a prime number,then 
check it out this code .

CODE: 

/* package whatever; // don't place package name! */

import java.util.Scanner;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main 
{
    public static void main (String[] args) throws java.lang.Exception
    {
        int n;          
        Scanner sc= new Scanner (System.in);

    n = sc.nextInt();
        if(n<=1)
        System.out.println(" no p not comp");
        else 
    {
        int c =2;
        while(c*c < n)
        {
          if(n%c==0)
          {
          System.out.println("not prime ");
          System.exit(0); }
          else 
          c++;

        }