0

How to create a code that says something if the input number is between 2 numbers

I need to an app that says something if the user inputs a certain number. It should display a string if the number is in between 2 certain numbers

6th Dec 2018, 5:44 PM
EthanPlusPlus
EthanPlusPlus - avatar
6 Answers
+ 8
Can you give the sample output? Have you tried it doing by yourself?
6th Dec 2018, 6:03 PM
blACk sh4d0w
blACk sh4d0w - avatar
6th Dec 2018, 6:11 PM
M. S. K. AnAwasd
0
Sample output meaning...? I'm a real beginner I have and have figured a few things out I am now using conditionals for the age and a Scanner class for input
6th Dec 2018, 6:04 PM
EthanPlusPlus
EthanPlusPlus - avatar
0
Thanks u so much I told u I am real beginner
6th Dec 2018, 6:13 PM
EthanPlusPlus
EthanPlusPlus - avatar
0
Actually sorry this not correct, my code is in Java not python
6th Dec 2018, 6:29 PM
EthanPlusPlus
EthanPlusPlus - avatar
0
Ok, here is the Java code. Very simple and basic. :-) import java.util.Scanner; public class Main { public static void main(String[] args) { /* This is really simple task */ //We need Scanner to take user input Scanner in = new Scanner(System.in); //Communicate with user System.out.println("Input number, if you are lucky enough, will receive a million $US worth wisdom"); //store user input int userInput = in.nextInt(); //we don't need Scanner anymore in.close(); // so we are already ready for final task //let's say our range is (-32, 1023) if(-32 < userInput && userInput <1023){ //if true we got the winner System.out.println("C O N G R A T U L A T I O N ! ! !\n(Print some great wisdom here...)"); }else{ //if not in range *this block is optional, you can delete it System.out.println("Sorry, not lucky day today..."); } } }
6th Dec 2018, 10:52 PM
vlada