import java.util.Scanner;
public class ifwhileloop {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args)
{
double nmbr;
*********** while(nmbr < 101){ ---- this gives me the error!!!
System.out.print("Enter the number:");
nmbr = sc.nextDouble();
if(nmbr <= 5){
System.out.println("the number is between 0 and 5 and is: " + nmbr);
}
else if(nmbr >= 6 && nmbr <=9) {
System.out.println("the number is between 6 and 9 and is: " + nmbr);
}
else if(nmbr >= 10 && nmbr <= 100 ) {
System.out.println("the number is between 10 and 100 and is: " + nmbr);
}
else
System.out.println("the number is bigger than 100:" + nmbr);
//nmbr ++;
}
}
}
Trying to use a while loop with input.
1733
28-Apr-2015
Here is my code so far. I am trying to get the WHILE LOOP to work so the user inputs a number, the if statement prints the output and then it returns to ask for another number and goes again and again looping :
Anonymous User
28-Apr-2015