(int n)
| 7 | |
| 8 | //Method to check if the number is a Lucky Number |
| 9 | public boolean checkLucky(int n) |
| 10 | { |
| 11 | if(c > n) |
| 12 | return true; |
| 13 | if(n % c == 0) |
| 14 | return false; |
| 15 | |
| 16 | //Position of the element |
| 17 | n = n - (n/c); |
| 18 | |
| 19 | //Incrementing the counter variable |
| 20 | c++; |
| 21 | return checkLucky(n); |
| 22 | } |
| 23 | |
| 24 | //Main method |
| 25 | public static void main(String[] args) |