Friday, June 28, 2019

Automorphic Number Programming | In JAVA | Eclipse |



import java.util.Scanner;
public class automorphic_number
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter the number to be checked ");
int n  = sc.nextInt();
int square  = n*n;     
System.out.println(square);
String s = Integer.toString(n);
int l = s.length();           
double power = Math.pow(10, l);
double rem = square%power;
if(rem==n)
System.out.println(n+" is an automorphic number");
else
System.out.println(n+" is not an automorphic number");
sc.close();
}
}
/*
Input  : N = 76
Output : Automorphic
Explanation: As 76*76 = 5776

Input  : N = 25
Output : Automorphic
As 25*25 = 625

Input : N = 7
Output : Not Automorphic
As 7*7 = 49
 5
 25

 */

No comments:

Post a Comment

ICSE COMPUTER SCIENCE SPECIMEN PAPER | QUESTION 7 | PLEASE DO WATCH THE VIDEO

  import  java.util.*; class icse_specimen_1 {     public static void main(String[] args)     {         Scanner sc1 = new Scanner(System.in)...