• . Даны три целых числа. Найти количество положительных чисел в исходном наборе.

Ответы 1

  • import java.util.*;import java.lang.*;class Brainly{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int a, b, c; System.out.print("Enter a: "); a = sc.nextInt(); System.out.print("Enter b: "); b = sc.nextInt(); System.out.print("Enter c: "); c = sc.nextInt(); int pol[] = new int[3]; pol[0] = a; pol[1] = b; pol[2] = c; for(int i = 0; i < 3; i++){ if(pol[i] < 0){ pol[i] = 0; }; }; for(int i = 1; i < 3; i++){ pol[0] += pol[i]; }; System.out.print("sum: " + pol[0]); }}
  • Добавить свой ответ

Еще вопросы

Войти через Google

или

Забыли пароль?

У меня нет аккаунта, я хочу Зарегистрироваться

How much to ban the user?
1 hour 1 day 100 years