Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

Simple Java Program compile errors getting

$
0
0
import java.io.*;
class A
{
    int c=0;
    int i[50];
    int l;
    int j[50];
    int n;
    int k;
    int P;
    public void EvenOdd()
    {
        for(n=1;n<=100;n++)
        {
        if(n%2==0)

        System.out.println(n);
        }
    }
    public void Prime()
    {
        for(P=1;P<=100;P++)
        {
        for(l=P;l<=P;l++)
        {
            if(P%l==0)
            c++;
        }
        if(c==2)
            for(k=0;k<=P-1;k++)
            {
            j[k]=P;
        System.out.println(j[k]);
            }
        }
    }
}
class B
{
    public static void main(String args[])
    {
        A a=new A();
        a.EvenOdd();
        a.Prime();
    }
}

This is my code to find the prime numbers in the specified range but when i am compiling the program there are lot of errors can u please suggest me what is wrong in it? syntax error or any other errors?


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>