Create a Prompter application that prompts the user for two numbers. The first number is a min value and the second is a max value. Prompter then prompts the user for a number between the min and max numbers entered. The user should be continually prompted until a number within the range is entered. Be sure to include the min and max numbers in the prompt.
int num1,num2,range; System.out.print("Enter the first number:"); num1=input.nextInt(); System.out.print("Enter the second number:"); num2=input.nextInt(); do{ System.out.print("Enter a number between 1st and 2nd:"); range=input.nextInt();} while (range<num1&&range>num2); }}
what am i doing wrong
Anything. 1. Give us the whole code, not that cut. 2. What Language are you coding in? 3. Did you intialize the variable input the right way (InputStream and StreamReader or equal)? 4. The boolean query is wrong. num1 is the lower value, num2 the higher, so you have to ask if the third number is higher than num1 und lower than num2 - you ask the opposite.
Join our real-time social learning platform and learn together with your friends!