An authentic Adam Number program
Adam Number program: solved Java program for ISC Class 12 Computer Science with complete BlueJ code, explanation and sample output.
A number is said to be adam number if a number is squared and reversed and then its root is found out and again reversed and hence if the number obtained is same as the initial number then its is called an adam number.
Adam numbers up to 1000 are: 0, 1, 2, 3, 11, 12, 13, 21, 22, 31, 101, 102, 103, 111, 112 , 113, 121, 122, 201, 202, 211, 212, 221, 301, 311.
Click here for java videos
import java.io.*;
class Adam
{
static int rev(int num)
{
int rev=0;
while(num!=0)
{
int rem=num%10;
rev=rev*10+rem;
num=num/10;
}
return rev;
}
static int sq(int a)
{
int sq_a=a*a;
return sq_a;
}
static boolean isAdam(int b)
{
int b_sq=sq(b); //square of real num
int rev_b=rev(b); //reverse of real num
int sq_rev=sq(rev_b); //square of reversed num
int rev_sq=rev(sq_rev); //reverse of the square of the reversed num
if(b_sq==rev_sq)
{
return true;
}
else
{
return false;
}
}
public static void main()throws IOException
{
BufferedReader br=new BufferedReader(new
InputStreamReader(System.in));
System.out.println("ENTER THE RANGE");
System.out.println("ENTER LOWER LIMIT");
int m=Integer.parseInt(br.readLine());
System.out.println("ENTER UPPER LIMIT");
int n=Integer.parseInt(br.readLine());
int freq=0;
if(m<n)
{
System.out.println("THE ADAM INTEGERS ARE:");
for(int i=m;i<=n;i++)
{
if(isAdam(i)==true)
{
System.out.print(i+"\t");
freq++;
}
}
System.out.println();
System.out.println("FREQUENCY OF ADAM INTEGERS IS: "+freq); }
else
{
System.out.println("INVALID RANGE");
}
}
}Output:
ENTER THE RANGE
ENTER LOWER LIMIT
100
ENTER UPPER LIMIT
200
THE ADAM INTEGERS ARE:
101 102 103 111 112 113 121 122
FREQUENCY OF ADAM INTEGERS IS: 8
Keith Number
Related Posts
Continue learning with these related articles

Logic Gates for ISC Class 11: Truth Tables, Universal Gates, Half and Full Adder
ISC Class 11 Computer Science notes on logic gates: AND, OR, NOT, NAND, NOR, XOR and XNOR with truth tables, why NAND and NOR are universal gates, and half adder and full adder circuits with their Boolean expressions.
Decimal to Binary Conversion in Java: 3 Programs with Examples
How to convert a decimal number to binary on paper and in Java: three programs (String, place value and Integer.toBinaryString), binary to decimal, a dry run and common mistakes.

ISC Class 11 Computer Science Sample Paper 2026-27 with Solutions
A full 70-mark ISC Class 11 Computer Science sample paper for the 2026-27 annual exam: MCQs, number systems, propositional logic, logic gates, Java classes, arrays, strings, searching and sorting, and computing ethics, with complete worked solutions.