Friday, July 31, 2020

Write a program to input a number and check whether it is Trimorphic Number or not? (5^3=125, number is present in the last)

66)  Write a program to input a number and check whether it is Trimorphic Number or not? (53=125, number is present in the last)


import java.util.*;
public class Trimorphic
{
    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++;
              }
              int p = a*a*a;
              int x = (int)Math.pow(10,c);
              int m = p%x;
              if(m==a)
              {
                  System.out.println("Entered number is a TRIMORPHIC Number");
              }
              else
              {
                  System.out.println("Entered number is not a TRIMORPHIC Number");
              }
   }
}

Output : 



Write a program to find Frequency of Every Digit in a number?(1616336331, 1 - 3 times, 3 - 4 times, 6 – 3 times)

67)  Write a program to find Frequency of Every Digit in a number?(1616336331,  1 - 3 times, 3 - 4 times, 6 – 3 times)


import java.util.*;
public class Frequency_of_digits
{
    public static void main(String args[ ])
   {
              Scanner sc = new Scanner (System.in);
              System.out.println("Enter a number");
              int b = sc.nextInt();
              int a = b;
              while(a>0)
              {
                  int d = a%10;
                  int z = b;
                  int f = 0;
                  int t = 0; 
                while(z>0)
                {
                    if(d==z%10&&z>a)
                    {
                        t++;
                    }
                    else if(d==z%10&&t==0)
                    {
                        f++;
                    }
                    z=z/10;
                }
                a=a/10;
                if(f>0)
                {
                System.out.println("FREQUENCY OF "+d+" = "+f+" Times");
                }
              }
   }
}

Output : 



Write a program to input a number and check whether it is Automorphic Number or not?(25^2=625, 5^2=25)

65)  Write a program to input a number and check whether it is Automorphic Number or not?(252=625, 52=25)


import java.util.*;
public class Automorphic
{
     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++;
              }
              int p = a*a;
              int x = (int)Math.pow(10,c);
              int m = p%x;
              if(m==a)
              {
                  System.out.println("Entered number is a AUTOMORPHIC Number");
              }
              else
              {
                  System.out.println("Entered number is not a AUTOMORPHIC Number");
              }
   }
}

Output : 




Write a program to input a number and check whether it is Kaprekar’s Number or not? (297=297*297=88209=88+209=297)

64)  Write a program to input a number and check whether it is Kaprekar’s Number or not? (297=297*297=88209=88+209=297)


import java.util.*;
public class Kaprekars
{
    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++;
              }
              int p = a*a;
              int x = (int)Math.pow(10,c);
              int m = p%x;
              int n = p/x;
              if((m+n)==a)
              {
                  System.out.println("Entered number is a KAPREKAR's Number");
              }
              else
              {
                  System.out.println("Entered number is a KAPREKAR's Number");
              }
   }               
}

Output : 




Write a program to input a number and find the Super Digit of this number.(7645, number’s largest digit+1=super digit, 7+1=8)

63)  Write a program to input a number and find the Super Digit of this number.(7645, number’s largest digit+1=super digit, 7+1=8)


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

Output :





 

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 : 


 jhvghvgk ;nkjn ,nkjhj