I wrote the below code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I wrote the below code

But i could not figure out what it does. Can anyone tell me please import java.io.*; public class NumberOfNegative{ public static void main(String[] args)throws Exception{ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String s1 = reader.readLine(); String s2 = reader.readLine(); int a = Integer.parseInt(s1); int b = Integer.parseInt(s2); if(a>0 && b>0){ System.out.println(1); } else if(a<0 && b>0){ System.out.println(2); } else if(a<0 && b<0){ System.out.println(3); } else if(a>0 && b>0){ System.out.println(2); } } }

4th Aug 2020, 7:20 PM
stephen haokip
stephen haokip - avatar
3 Answers
0
I swear i wrote it man. Some months back
4th Aug 2020, 7:51 PM
stephen haokip
stephen haokip - avatar
0
But that time i guess i dont run it...
4th Aug 2020, 7:53 PM
stephen haokip
stephen haokip - avatar
0
I understand your 1 and 2. But i m not sure about the condition check. I believe i wrote it to check for negative number or somethin
4th Aug 2020, 8:11 PM
stephen haokip
stephen haokip - avatar