write a programme to check nelson number in java
Answers
the number 111 is called a nelson number and multiple of nelson are called double Nelson (222), triple Nelson (333) and so on. We need to note that multiples of 111 are Nelson numbers e.g 111, 222, 333, 444, 555, 666, 777, 888 and 999. Not any other number which is divisible by 111.
Hope this helps you!!
Answer:
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter a number");
int n=in.nextInt();
if(n==111 || n==222 || n==333 || n==444 ||
n==555 || n==666 || n==777 || n==888 || n==999){
System.out.println("Nelson Number");
} else {
System.out.println("Not a Nelson Number");
}
}
}
Explanation:
this may help you
please mark this answer as brainlist answer please
please give thanks to me in this answer