package com.codegym.task.task04.task0428;
/*
Positive number
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
String x=bf.readLine();
String y=bf.readLine();
String z=bf.readLine();
int a=Integer.parseInt(x);
int b=Integer.parseInt(y);
int c=Integer.parseInt(z);
int num=0;
if (a>0) num++;
else if(b>0)num++;
else if(c>0)num++;
System.out.println(num) ;
}
}
I can't find mistake in my code...what should I do?
Under discussion
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Hendra
10 December 2019, 11:59
thanks
0
Anthony Chalk
10 December 2019, 10:42
Change:
to
When you write "else if", as soon as one of the conditions is fulfilled, the rest of them aren't checked, but you need to check each number separately. 0