Posts

Showing posts with the label Number Program

Automorphic Number.

Image
Program to check whether a given number is Automorphic number or not. A number is said to an automorphic number if its "square" ends with the same digits as the number itself. for example, 5, 6, 76, 376 etc  are automorphic number as its square are 25, 36, 5776, 141376  and  5, 6, 76, 376  are present as the last digits. SOURCE CODE import java.io.*; public class Automorphic {     public static void main(String args[])throws IOException     {         BufferedReader br=new BufferedReader(new InputStreamReader(System.in));         System.out.print("Enter a number    :");         int a=Integer.parseInt(br.readLine());         int sq=a*a;         int rem,n=a,j=1;         while(n>0)         {             rem=n%10;...

Buzz Number.

Image
Program to check whether a given number is Buzz or not. A number is said to be Buzz number if it ends with 7 or is divisible by 7. Example 1007 is a Buzz number as it end with 7. Similarly, 49 is also a Buzz number as it is divisible by 7. SOURCE CODE import java.io.*; public class Buzz_Number {     public static void main(String args[])throws IOException     {         BufferedReader br=new BufferedReader (new InputStreamReader(System.in));         System.out.print("Enter a number    :");         int a=Integer.parseInt(br.readLine());         if(a%10==7||a%7==0)         System.out.println("Yes,It is a Buzz No.");         else         System.out.println("No,It is not a Buzz No.");     } } OUTPUT Click Here  to download program ...

Special Number.

Image
Program to check whether a given number is Special number or not. A number is said to be special number when the sum of factorial of its digits is equal to the number itself . Example 145 is a Special Number as 1!+4!+5!=145 SOURCE CODE import java.io.*; public class Special_Number {     public static void main(String args[])throws IOException     {         BufferedReader br=new BufferedReader(new InputStreamReader(System.in));         System.out.print("Enter a Number    :");         int num=Integer.parseInt(br.readLine());         int rem,fact,n=num,sum=0;         while(n>0)         {             fact=1;             rem=n%10;             for(int j=1;j<=rem;j++)         ...

Magic Number.

Image
Program to check whether a given number is Magic number or not. A number is said to be a Magic number if the sum of its digits are calculated till a single digit is obtained by recursively adding the sum of its digits. If the single digit comes to be 1 then the number is a magic number. For example 199 is a magic number as 1+9+9=19 but 19 is not a single digit number so 1+9=10 and then 1+0=1 which is a single digit number and also 1 . Hence it is a Magic number. SOURCE CODE import java.io.*; import java.util.*; public class Magic {     public static void main(String args[])     {         Scanner sc=new Scanner(System.in);         System.out.print("Enter a number    :");         int n=sc.nextInt();         int s=n;         while(s>9)         {           ...

Disarium Number.

Image
Program to check whether a given number is Disarium or not. A number will be called Disarium if sum of its digits powered with their respective postion is equal to the original number. eg. 135 is a Disarium number because  135 = (1)+(3*3)+(5*5*5) similarly 89, 175, 518 etc  are Disarium number SOURCE CODE import java.io.*; public class Disarium {     public static void main(String args[])throws IOException     {         BufferedReader br=new BufferedReader(new InputStreamReader(System.in));         System.out.print("Enter a Number  :");         int a=Integer.parseInt(br.readLine());         int re,c=a,j=0;         while(c>0)         {             c=c/10;             j++;         }     ...

Neon Number.

Image
Program to check whether a given number is Neon or not. A neon number is a number where the sum of digits of square of the number is equal to the number. For example if the input number is 9, its square is 9*9=81 and sum of the digits is 9 i.e, 9 is a neon number. SOURCE CODE import java.io.*; public class Neon {     public static void main(String args[])throws IOException     {         BufferedReader br=new BufferedReader(new InputStreamReader(System.in));         System.out.print("Enter a Number  :");         int a=Integer.parseInt(br.readLine());         int sq=a*a;         int rem,num=0,n;         n=sq;         while(n>0)         {             rem=n%10;             num=num+rem; ...

Palindrome Number.

Image
Program to check whether a given number is Palindrome or not. A palindromic number or numeral palindrome is a number that remains the same when its digits are reversed. Like 16461 , for example, it is "symmetrical". SOURCE CODE i mport java.io.*; public class Palindrome {     public static void main(String args[])throws IOException     {         BufferedReader br=new BufferedReader (new InputStreamReader(System.in));         System.out.print("Enter a number    :");         int a=Integer.parseInt(br.readLine());         int rem,palen=0,n;         n=a;         while(n>0)         {             rem=n%10;             palen=palen*10+rem;             n=n/10;       ...

ISBN Number.

Image
Program to check whether a given number is ISBN number or not. An ISBN(International Standard Book Number) is a ten digit code which uniquely identifies a book. The first nine digits represent the Group, Publisher and Title of the book. Each of the first nine digits of the code can take a value between 0 and 9. Sometimes it is necessary to make the last digit equal to ten, this is done by writing the last digit of the code as 'X' To verify an ISBN number, calculate 10 times the fist digit, plus 9 times the second digit, plus 8 times the third and so on until 1 time the last digit. If the final number leaves no remainder when divided by 11, the code is a valid number. eg. 007462542X = (10*0)+(9*0)+(8*7)+(7*4)+(6*6)+(5*2)+(4*5)+(3*4)+( 2*2)+(1*10)=176 Similarly 0764526413 and 0112362221                           SOURCE CODE import java.io.*; public class ISBN {     pu...

Armstrong Number.

Image
Program to check whether a given number is Armstrong number or not. An Armstrong number of three digits is an integer such that he sum of the cubes of its digits is equal to the number itselt for example, 371 is an Armstrong number since  (3*3*3)+(7*7*7)+(1*1*1)=371 SOURCE CODE import java.io.*; public class Armstrong  {     public static void main(String args[])throws IOException     {         BufferedReader br=new BufferedReader (new InputStreamReader(System.in));         System.out.print("Enter a number    :");         int a=Integer.parseInt(br.readLine());         int rem,arm=0,n;         n=a;         while(n>0)         {             rem=n%10;             arm=arm+(int)Math.pow(rem,3);   ...