Добрый день! При проверке не проходит условие "Программа должна выводить количество положительных чисел в исходном наборе." Хотя при запуске без проверки все считает. Тестировал в интеллидж айдиа тоже считает.
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
//напишите тут ваш код
BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));
String a1 = reader.readLine();
int a = Integer.parseInt(a1);
String b1 = reader.readLine();
int b = Integer.parseInt(b1);
String c1 = reader.readLine();
int c = Integer.parseInt(c1);
Summ summa = new Summ();
if (a <= 0 & b <= 0 & c <= 0)
System.out.println(0);
else {
if (a > 0)
summa.summpolchisel(1);
if (b > 0)
summa.summpolchisel(1);
if (c > 0)
summa.summpolchisel(1);
System.out.println(Summ.summa);}
}
public static class Summ {
public static int summa = 0;
public static void summpolchisel(int a) {
Summ.summa = Summ.summa + a; }
}
}package com.javarush.task.task04.task0428;
/*
Положительное число
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
//напишите тут ваш код
BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));
String a1 = reader.readLine();
int a = Integer.parseInt(a1);
String b1 = reader.readLine();
int b = Integer.parseInt(b1);
String c1 = reader.readLine();
int c = Integer.parseInt(c1);
Summ summa = new Summ();
if (a <= 0 & b <= 0 & c <= 0)
System.out.println(0);
else {
if (a > 0)
summa.summpolchisel(1);
if (b > 0)
summa.summpolchisel(1);
if (c > 0)
summa.summpolchisel(1);
System.out.println(Summ.summa);}
}
public static class Summ {
public static int summa = 0;
public static void summpolchisel(int a) {
Summ.summa = Summ.summa + a; }
}
}