Answer:
import java.util.*;
public class LuckyNumber
{
public static void main(String args[])
{
Scanner sc = new Scanner (System. in) ;
int number ;
int sq =0 , rem = 0,s = 0,rev = 0,count =0;
System.out.println("ENTER A NUMBER ");
number = sc. nextInt( );
while(number != 0 )
{
rem = number % 10;
rev = rev * 10 + rem;
number /=10;
count = count +1;
} // while close
for(int i = 1;i < count; i++)
{
rem = rev % 10 ;
rev = rev /10;
if(i%2 ==0) {
sq = rem * rem ;
s = s+ sq ;
} //if close
} // for close
if ( s%9 == 0 )
{
System.out.println( " LUCKYYYYY NUMBER!! " );
}//if close
else
{
System.out.println( " NOT SO LUCKY " );
} //else close
}//main close
}// class close
OUTPUT :
ENTER A NUMBER
134359
LUCKYYYYY NUMBER!!
---------------------------------------
ENTER A NUMBER
12212
NOT SO LUCKY
Explanation: