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 :
trimorphic-number Write a program to input a number and check whether it is Automorphic Number or not?(252=625, 52=25) |
No comments:
Post a Comment
if you have any doubts, Please let me know.
Your Truly
Shashank Porwal