Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.math.*;
- public class Lesson_34_Activity_Six {
- static Scanner scanner = new Scanner(System.in);
- public static boolean allPositive(int a[]) {
- int check = 0;
- for(int i = 0; i < a.length;i++) {
- if(a[i] < 0) {
- check = 1;
- }
- }
- if(check == 1 ) {
- return false;
- }
- return true;
- }
- public static void main(String[] args) {
- int a[] = {-1,2,3,4,5};
- boolean x = allPositive(a);
- System.out.println(x);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement