Ask Experts Questions for FREE Help !
Ask
    albear's Avatar
    albear Posts: 1,594, Reputation: 222
    Ultra Member
     
    #1

    Oct 12, 2007, 01:49 AM
    what's wrong with this
    reet, its meant to tell you if the number that the user inputs is between the range but for some reason it doesn't like it. Any help would be great.

    import java.util.*; // the package containing Scanner
    public class Range
    {
    public static void main(String[] args)
    {

    Scanner kybd = new Scanner(System.in);

    //input

    System.out.println("Enter an integer");
    int Num1;
    Num1 = kybd.nextInt();

    //calculations and output

    If ((10 <= Num1)&&(Num1<=50) )

    System.out.println("The Integer is between 10 and 50" );

    Else

    System.out.println("The integer is not within the boundaries");


    }
    }
    albear's Avatar
    albear Posts: 1,594, Reputation: 222
    Ultra Member
     
    #2

    Oct 12, 2007, 05:36 AM
    Please...
    benn11's Avatar
    benn11 Posts: 1,036, Reputation: 43
    Ultra Member
     
    #3

    Oct 12, 2007, 05:48 AM
    Try this

    If ((10 >= Num1)&&(Num1<=50) )

    System.out.println("The Integer is between 10 and 50" ); //because the integer should be more than 10 and less than 50 to be "bettween 10 and 50"
    albear's Avatar
    albear Posts: 1,594, Reputation: 222
    Ultra Member
     
    #4

    Oct 12, 2007, 05:53 AM
    I agree but you've put if Num is less than 10, ill try it and see
    albear's Avatar
    albear Posts: 1,594, Reputation: 222
    Ultra Member
     
    #5

    Oct 12, 2007, 05:56 AM
    Nope still doesn't like it. Itstill has the same erors either way around

    It has a problem with the if part on wards

    Thanks for answering
    qcumber's Avatar
    qcumber Posts: 5, Reputation: 1
    New Member
     
    #6

    Nov 14, 2007, 09:33 PM
    If ((10 <= Num1)&&(Num1<=50) )
    {
    System.out.println("The Integer is between 10 and 50" );
    }
    else
    {
    System.out.println("The integer is not within the boundaries");
    }

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search


Check out some similar questions!

What's wrong [ 2 Answers ]

There was a bad thunderstorm and a pole was hit by lighting and our lights went out I was in my room watching TV and my kids where in the living room watching TV when the lights came back on the TV in the room would not come back on we unpluged it and pluged it back on when we try to turn it on you...

What's wrong [ 2 Answers ]

Okay I am 17 and I have never had sex but there are times were I don't have a peirod for like 2 to 3 months... can anyone tell me why this is... :confused:

What's wrong with me? [ 2 Answers ]

I was supposed to start my period on the 3rd and I did, but I bled that day and then I didn't bleed at all the next day, then on the 5th I bled and the sixth I didn't bleed.. I don't know why my period is being like this, a couple days before I started my period I had sex.. so I don't know if this...

What's wrong? [ 4 Answers ]

To start by saying I'm new here, so bare with me. My problem is that my periods are very very heavy and lasts about 7 full days. My problem this month is that this time it was very very light and only lasted two days. My tubes are tied(the less perminant type) and I'm not on birth control pills....

What's Wrong With Me? [ 26 Answers ]

The Past Two Years Have Been A Major Rollercoaster For Me... Between Bad Relationships An Family Problems All Of It Has Really Affected Me Emotionally And Is Really Starting To Take Its Toll On My Life... ive Lost All My Friends Because Of My Bad Traits An Insane Ways Of Self Harm. Which Is How I...


View more questions Search