106k views
4 votes
import java.util.Scanner; public class FindSpecialValue { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); int specialNum; specialNum = scnr.nextInt(); if (specialNum ) { System.out.println("Special number"); } else { System.out.println("Not special number"); } }

User Lovntola
by
4.5k points

1 Answer

2 votes

Answer:

Java program explained below

Step-by-step explanation:

FindSpecialNumber.java

import java.util.Scanner;

public class FindSpecialNumber {

public static void main(String[] args) {

//Declaring variable

int number;

/*

* Creating an Scanner class object which is used to get the inputs

* entered by the user

*/

Scanner sc = new Scanner(System.in);

//getting the input entered by the user

System.out.print("Enter a number :");

number = sc.nextInt();

/* Based on user entered number

* check whether it is special number or not

*/

if (number == -99 || number == 0 || number == 44) {

System.out.println("Special Number");

} else {

System.out.println("Not Special Number");

}

}

}

_______________

Output#1:

Enter a number :-99

Special Number

Output#2:

Enter a number :49

Not Special Number

User Shayonj
by
4.4k points