Sei sulla pagina 1di 1

Sheet1

/* Write a Java Program to check whether the entered number is Automorphic Number or not.

-A number is called Automorphic if and only if its square ends in the same digits as the number itself.

Sample :
5 //input
1 //output

Sample 2 :
25 //input
1 //output

Sample 3:
14 //input
-1 //output

*/
import java.util.Scanner;
class Pattern
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int arr[]=new int[10];
for(int i=0;i<arr.length;i++)
{
arr[i]=sc.nextInt();
}
for(int i=0;i<arr.length;i++)
{
for(int j=0;j<i;j++){
System.out.print(arr[i]+" ");
j++;
if(!(j<i))
System.out.print(arr[++i]+" ");
}
System.out.println();
}
}
}
*/

Page 1

Potrebbero piacerti anche