Can anybody tell me why this code did not pass the test?

package com.javarush.test.level04.lesson16.home03;

import java.io.*;

/ Calculate a sum Write a program that reads from keyboard numbers and calculates their sum. If the user entes -1, the program should display the sum and terminate. -1 should be included in sum. /

public class Solution { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String number = reader.readLine(); String number1 = reader.readLine(); int n = Integer.parseInt(number); int m = Integer.parseInt(number1);

    if ((n == -1) || (m == -1))
    {
        System.out.println(m + n);

    }
}

}

asked 09 Nov '17, 10:25

matif118's gravatar image

matif118
1
accept rate: 0%

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×36

Asked: 09 Nov '17, 10:25

Seen: 250 times

Last updated: 09 Nov '17, 10:25