0% found this document useful (0 votes)
36 views

Class Checker - ISC COMPUTER PROJECT 2018: Import Class Long Long Long

This document contains code for a Java class called Checker that checks if a number is a palindrome prime. It takes a long integer as input, defines methods to reverse the number, check if it is prime, and display whether it is a palindrome prime or not. The main method gets user input, creates a Checker object, and calls the Display method.

Uploaded by

Bibhas Pal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Class Checker - ISC COMPUTER PROJECT 2018: Import Class Long Long Long

This document contains code for a Java class called Checker that checks if a number is a palindrome prime. It takes a long integer as input, defines methods to reverse the number, check if it is prime, and display whether it is a palindrome prime or not. The main method gets user input, creates a Checker object, and calls the Display method.

Uploaded by

Bibhas Pal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Class Checker - ISC COMPUTER PROJECT 2018 1/2

1 import java.util.*;
2 class Checker
3 {
4 long num;
5 long rev;
6 Checker(long z)
7 {
8 num=z;
9 }
10 long ReverseNum(long q)
11 {
12 if(q>0)
13 {
14 rev=rev*10+(q%10);
15 return ReverseNum(q/10);
16 }
17 else
18 return rev;
19 }
20 Boolean Prime()
21 {
22 int c=0;
23 for(int i=1;i<=num;i++)
24 {
25 if(num%i==0)
26 {
27 c++;
28 }
29 }
30 if(c==2)
31 return true;
32 return false;
33 }
34 void Display()
35 {
36 if(ReverseNum(num)==num&& Prime()==true)
37 {
38 System.out.println("THE NUMBER "+num+" IS A PALPRIME");
39 }
40 else
41 {
42 System.out.println("THE NUMBER "+num+" IS NOT A PALPRIME")
;
43 }
44 }
45 void main()
46 {
47 Scanner sc=new Scanner(System.in);
48 System.out.println("ENTER NUMBER");
49 long z=sc.nextLong();
50 Checker obj=new Checker(z);
51 obj.Display();
52 }

5 Aug, 2017 10:02:57 PM


Class Checker - ISC COMPUTER PROJECT 2018 (continued) 2/2

53 }
54

5 Aug, 2017 10:02:57 PM

You might also like