Number Programs in java ICSE Part-2
Number Programs in Java ICSE Part-2: solved Java program for ICSE Class 10 Computer Applications with complete BlueJ code, explanation and sample output.
Watch java videos
Number Programs in java ICSE has some important number programs for the ICSE students.

Number Programs in java ICSE
- Palindrome number:- Palindrome number is a number when it is reversed, it remains same. (For example: 131, when You reverse it it doesn't change)
import java.io.*;
class palindrome
{
public static void main()throws IOException
{
BufferedReader br=new BufferedReader (new InputStreamReader(System.in));
System.out.println("Give a number");
int num=Integer.parseInt(br.readLine());
int rem;
int n=num;
int rev=0;
do
{
rem=num%10;
rev=rev*10+rem;
num=num/10;
}while(num!=0);
{
if(rev==n)
System.out.println("This is a palindrome number");
else
System.out.println("This is not a palindrome number");
}
}
}
I/P:- 151
O/P: This is a palindrome number
I/P:- 125
O/P: This is not a palindrome number
2.Sum of the digits:- This programs Takes a number from the user and gives you the sum of the digits of the number.
import java.io.*;
class sum
{
public static void main()throws IOException
{
BufferedReader br=new BufferedReader (new InputStreamReader(System.in));
System.out.println("Give a number");
int num=Integer.parseInt(br.readLine());
int rem;
int n=num;
int sum=0;
do
{
rem=num%10;
sum+=rem;
num=num/10;
}while(num!=0);
System.out.println("The number you have entered is "+n);
System.out.println("The sum of the digits is" +sum);
}
}
I/P:- 125
O/P: The number you have entered is
The sum of the digits is 8
3. Reverse the number:- This program takes a number from the user, reverses it and then prints it on the terminal window.
import java.io.*;
class Reverse
{
public static void main()throws IOException
{
BufferedReader br=new BufferedReader (new InputStreamReader(System.in));
System.out.println("Give a number");
int num=Integer.parseInt(br.readLine());
int rem;
int n=num;
int rev=0;
do
{
rem=num%10;
rev=rev*10+rem;
num=num/10;
}while(num!=0);
System.out.println("The original number is "+n);
System.out.println("The reverse of the number is "+rev);
}
}
I/P:- 157
O/P: The original number is 157
The reverse of the number is 751
Number Programs in java ICSE
String Handling in JAVA
Related Posts
Continue learning with these related articles
Sum of First n Natural Numbers in Java (Loop and Formula)
Find the sum of the first n natural numbers in Java with a for loop, a while loop and the formula n(n + 1)/2, with a dry run and the sums of even numbers, odd numbers, squares and cubes.
Prime Number Program in Java: Check a Number and Print Primes in a Range
Check whether a number is prime in Java by counting its factors, a faster square-root method with isPrime(), and a program that prints all prime numbers in a range.

Encapsulation, Access Specifiers and Scope of Variables in Java for ICSE Class 10
ICSE Class 10 Computer Applications notes on encapsulation: private, default, protected and public access, data hiding with getter and setter methods, instance vs static (class) variables, local variables and scope, with a solved BankAccount program.