diff --git a/Program's_Contributed_By_Contributors/Java_Programs/Misc/PalindromeArray.java b/Program's_Contributed_By_Contributors/Java_Programs/Misc/PalindromeArray.java new file mode 100644 index 0000000000..e8bfcc91a6 --- /dev/null +++ b/Program's_Contributed_By_Contributors/Java_Programs/Misc/PalindromeArray.java @@ -0,0 +1,66 @@ +//Coded by shreeyachatzz +//Accept integer numbers from user and print only the palindrome numbers. +import java.util.*;//importing +public class palin//declaring class +{ + void checkpalin(int m)//to check if number is palindrome + { + int s=0; + for( int i= m; i>0 ; i=i/10)//finding the reverse of the number using for-loop + { + int p= i%10; + s = s*10+p; + } + if( s== m )//to check if rev is equal to the original + { + System.out.print(m+" "); + } + } + + public static void main (String args[])//main method + { + Scanner sc= new Scanner (System.in);//Scanner class + int a[]= new int[500];//Declaring array + System.out.println("Enter the no. of integers you want to input:"); + int n= sc.nextInt();//accepting the number of integers to be checked + System.out.println("Enter the Integers:");//use for-loop to accept integers from user + for( int i= 0; i