Friday, July 31, 2020

Write a program to input a numbers and find the Smallest and Largest Digit of this number.(2784, smallest digit -2, largest digit -8)

62)  Write a program to input a numbers and find the Smallest and Largest Digit of this number.(2784, smallest digit -2, largest digit -8)


import java.util.*;
public class Smallest_Largest_digit
{
    public static void main(String args[ ])
   {
              Scanner sc = new Scanner (System.in);
              System.out.println("Enter a number");
              int a = sc.nextInt();
              int b = 9;
              int c = 0;
              while(a>0)
              {
                  int d = a%10;
                  if(d>c)
                  {
                      c=d;
                  }
                  else if(d<b)
                  {
                      b=d;
                  }
                  a=a/10;
              }
              System.out.println("Smallest digit = "+b);
              System.out.println("Largest digit = "+c);
   }
}

Output : 




Write a program to input a number and check whether it is Tech Number or not? (3025= (30+25)^2 = (55)^2 =3025 so it is tech number).

61)  Write a program to input a number and check whether it is Tech Number or not? (3025= (30+25)2 = (55)2 =3025 so it is tech number).


import java.util.*;
public class Tech_number
{
    public static void main(String args[ ])
   {
              Scanner sc = new Scanner (System.in);
              System.out.println("Enter a number");
              int a = sc.nextInt();
              int k = a;
              int c = 0;
              while(k>0)
              {
                  k=k/10;
                  c++;
              }
              if(c%2==0)
              {
                  int x = (int)Math.pow(10,(c/2));
                  int m = a%x;
                  int n = a/x;
                  int y = (int)Math.pow((m+n),2);
                  if(y==a)
                  {
                      System.out.println("Entered number is a TECH Number");
                  }
                  else
                  {
                      System.out.println("Entered number is not a TECH Number");
                  }
              }
              else
            {
                      System.out.println("Entered number is not a TECH Number");
            }
   }
}

Output : 


Thursday, July 30, 2020

Write a program to input a number and check whether it is Armstrong number (Narcissistic Number) or not? (153=13+53+33=1+125+27=153)

60)  Write a program to input a number and check whether it is Armstrong number (Narcissistic Number) or not? (153=13+53+33=1+125+27=153)


import java.util.*; 
public class Armstrong
{
   public static void main(String args[ ])
   {
              Scanner sc = new Scanner (System.in);
              System.out.println("Enter a number");
              int a = sc.nextInt();
              int k = a;
              int c = 0;
              while(k>0)
              {
                  k=k/10;
                  c++;
              }
              k = a;
              int s = 0;
              while(k>0)
              {
                  int d = k%10;
                  s=s+(int)Math.pow(d,c);
                  k=k/10;
              }
              if(s==a)
              {
                  System.out.println("Entered number is a ARMSTRONG Number ");
              }
              else
              {
                  System.out.println("Entered number is not a ARMSTRONG Number ");
              }
   }
}

Output : 



Tuesday, July 28, 2020

Write a program to input a number and check whether it is Lychrel number or not? (56 its reverse 65, 56+65=121 is a palindrome Number so it is Lychrel Number.)

58)  Write a program to input a number and check whether it is Lychrel number or not? (56 its reverse 65, 56+65=121 is a palindrome Number so it is Lychrel Number.)


import java.util.*;
public class Lychrel
{
    public static void main(String args[ ])
   {
              Scanner sc = new Scanner (System.in);
              System.out.println("Enter a number");
              int a = sc.nextInt();
              int k = a; 
              int r = 0;
              while(k>0)
              {
              int d = k%10;
              r=(r*10)+d;
              k=k/10;
              }
              int p = a+r;
              int m = 0;
              while(p>0)
              {
              int d = p%10;
              m=(m*10)+d;
              p=p/10;
              }
              if(m==a+r)
              {
                  System.out.println("Entered number is a LYCHREL Number ");
              }
              else
              {
                  System.out.println("Entered number is not a LYCHREL Number ");
              }
   }
}

Output : 



Write a program to input a number and check whether it is Special number (krishnamurti number, strong number) or not? (145=1!+4!+5!=1+24+120=145)

59)  Write a program to input a number and check whether it is Special number (krishnamurti number, strong number) or not? (145=1!+4!+5!=1+24+120=145)


import java.util.*;
public class Special_number
{
   public static void main(String args[ ])
   {
              Scanner sc = new Scanner (System.in);
              System.out.println("Enter a number");
              int a = sc.nextInt();
              int k = a;
              int s = 0;
              while(k>0)
              {
                  int d = k%10;
                  int p = 1;
                  for(int i = 1;i<=d;i++)
                  {
                      p=p*i;
                  }
                  s=s+p;
                  k=k/10;
              }
              if(s==a)
              {
                  System.out.println("Entered number is SPECIAL(KRISHNAMURTI,STRONG) Number ");
              }
              else
              {
                   System.out.println("Entered number is not a SPECIAL(KRISHNAMURTI,STRONG) Number ");
              }
   }
}

Output : 


 


Write a program to input a number and check whether it is Super Palindrome Number or not?(11 is a palindrome and also its square is palindrome ,so it is super palindrome)

57)  Write a program to input a number and check whether it is Super Palindrome Number or not?(11 is a palindrome and also its square is palindrome ,so it is super palindrome)


import java.util.*; 
public class Super_Palindrome
{
    public static void main(String args[ ])
   {
              Scanner sc = new Scanner (System.in);
              System.out.println("Enter a number");
              int a = sc.nextInt();
              int k = a;
              int r = 0;
              while(k>0)
              {
              int d = k%10;
              r=(r*10)+d;
              k=k/10;
              }
              if(r==a)
              {
                  int m = a*a;
                  int y = 0;
                  while(m>0)
                  {
                        int d = m%10;
                        y=(y*10)+d;
                        m=m/10;
                  }
                  if(y==(a*a))
                  {
                      System.out.println("Entered number is a SUPER PALINDROME Number ");
                  }
                  else
                  {
                      System.out.println("Entered number is not a SUPER PALINDROME Number ");
                  }
              }
              else
              {
                  System.out.println("Entered number is not a SUPER PALINDROME Number ");
              }
   }
}

Output : 


Monday, July 27, 2020

Write a program to input a number and check whether it is Palindrome Number or not?(121=121)

56)  Write a program to input a number and check whether it is Palindrome Number or not?(121=121)


import java.util.*;
public class Palindrome
{
     public static void main(String args[ ])
   {
              Scanner sc = new Scanner (System.in);
              System.out.println("Enter a number");
              int a = sc.nextInt();
              int k = a;
              int r = 0;
              while(k>0)
              {
              int d = k%10;
              r=(r*10)+d;
              k=k/10;
              }
              if(r==a)
              {
                  System.out.println("Entered number is a PALINDROME Number ");
              }
              else
              {
                  System.out.println("Entered number is not a PALINDROME Number ");
              }
   }
}

Output : 


  
palindrome-number



 jhvghvgk ;nkjn ,nkjhj