## 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