Question: sPositive is a method that accept an array as parameter, and checks if each element in the array arr positive or not positive If the
sPositive is a method that accept an array as parameter, and checks if each element in the array arr positive or not positive
If the element is positive print positive else print not positive
Complete main method by calling isPositive method.
Note: you might want to use for loop and if/else statement
Note: your first input is the number of ints in array, all other inputs will be values of array's elements.
-------------------------------------------------------------------------------------------------------------------------------------
import java.util.*;
class Main {
public static void main(String[] args) { Scanner inp = new Scanner(System.in); int size = inp.nextInt(); //#2 Your code here }
public static void isPos(int[] arr) { //#1 your code here
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
