Posts

Showing posts from March, 2017

Pattern of your own name.

Image
Pattern program of your own name. This is a pattern program, in this program you just have to enter your name and it will give you output in a particular manner. I have created this program when I was in class 10th for my Computer Application project. NOTE:  If you are copying my code then its a advise to you to copy it after downloading it to avoid any kind of compilation error its link is available at the bottom of source code. SOURCE CODE import java.io.*; public class Patter_of_your_Own_Name { public static void main(String args[])throws IOException { int time=1; BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); do { System.out.print("\n\t\t\tPLEASE,ENTER YOUR GOOD NAME IN CAPITAL LETTER           :"); String str=br.readLine(); int flag=0;

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++)             {                 fact=fact*j;             }             sum=sum+fact;             n=n/10;         }         if(sum==num)         System.out.println("Yes,It is a special NO.");         else         System.out.println(&qu

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)         {             n=s;s=0;             while(n>0)             {                 int rem=n%10;                 s=s+rem;                 n=n/10;             }        

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++;         }         int rem,d=0,n=a;         while(n>0)         {             rem=n%10;             d=d+(int)Math.pow(rem,j);             n=n/10;             j--;         }         if(d==a)         System.out.println("Yes,It is

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;             n=n/10;         }         if(num==a)         System.out.println("Yes,It is a Neon number");         else         System.out.println("No,It is not a Neon number");     } } Click here to  Down

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;         }         if(palen==a)         {               System.out.println("Yes,It is a palendrome No.");         }         else         {             System.out.println("No,It is not a palendrome No.");         }     } }

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 {     public static void main(String args[])throws IOException     {  

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);             n=n/10;         }         if(arm==a)         {             System.out.println("Yes, It is a Armstrong No.");         }         else         {             System.out.println("No, It is not a Arm

Interchange

Image
Program to interchange values stored in 'a' and 'b' SOURCE CODE import java.io.*; import java.util.*; public class Interchange {     public static void main(String args[])     {         Scanner sc=new Scanner(System.in);         System.out.print("Enter first number  :");         int a=sc.nextInt();         System.out.print("Enter second number :");         int b=sc.nextInt();         System.out.println("The values before interchange are "+a+" \t "+b);         int c;         c=a;         a=b;         b=c;         System.out.println("The values after interchange are "+a+" \t "+b);     } } Click here to  Download OUTPUT                                                     If you have any question then leave a comment below I will do my best to answer that question.

SAMPLE.

Image
SAMPLE class Sample {     public static void main (String args[])     {         System.out.println("Welcome to Puneet's Blog where Learning java is fun");     } }

My first blog.

Image
Hello guys this is my first post on blogger, I have created this blog so that I would be able to share all my knowledge regarding java programming(other as well if i could) with you all. Here I will teach you about java programming. Last but not the least thank you all guys and I hope this will be my very cool experience with you all.