Created
          November 13, 2013 23:41 
        
      - 
      
- 
        Save pepet96/7458569 to your computer and use it in GitHub Desktop. 
    ClassifyNumbers
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import java.util.Scanner; | |
| class ClassifyNumbers { | |
| public static void main(String [] args) { | |
| Scanner input = new Scanner(System.in); | |
| int initial, low, high, sum, value, i; | |
| System.out.println("How many numbers do you wish to analyze?"); | |
| initial = input.nextInt(); | |
| i = 1; | |
| sum = 0; | |
| System.out.println("which is the lowest integer that I should consider?"); | |
| low = input.nextInt(); | |
| System.out.println("which is the highest integer that I should consider?"); | |
| high = input.nextInt(); | |
| for (i = 1; i <= initial; i++){ | |
| System.out.println("Type a number: "); | |
| value = input.nextInt(); | |
| if (value <= low) { | |
| System.out.println("This number is out of range"); | |
| sum = sum; | |
| } | |
| else if (value >= high) { | |
| System.out.println("This number is out of range"); | |
| sum = sum; | |
| } | |
| else if (value >= low) { | |
| System.out.println("This number within range"); | |
| sum = sum + value; | |
| } | |
| } | |
| System.out.println("The sum is: " + sum); | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment