forked from anish-mishr/specialNumbers
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNelsonNumber.java
More file actions
27 lines (25 loc) · 769 Bytes
/
Copy pathNelsonNumber.java
File metadata and controls
27 lines (25 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package specialNumbers;
/**
* @author Anish
*
*
*/
public class NelsonNumber {
/* Nelson Number is a Number which is completely divisible by 111.
* for Example 333
*/
public static void nelsonNumber(int num) { // Static Method
// Check condition for Nelson Number
if(num%111==0)
System.out.println(">> "+ num +" is Nelson Number");
else
System.out.println(">> "+ num +" is NOT Nelson Number");
}
// MAIN METHOD
public static void main(String[] args) {
// Input is another public class having getNumber STATIC Method and a return type of INTEGER
System.out.println(" Find A Number is Nelson Number or NOT");
int num = Input.getNumber(); // gets the NUM
nelsonNumber(num); // Static method to check number is Nelson Number or NOT
}
}