Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Print positive numbers from array

public class NumPositives {
    public static void main(String[] args) {
        double a[] = {-4,5,7,-9};
        System.out.println("positive numbers");
        for (int i = 0; i < a.length; i++) {
            if (a[i]>=0){
                System.out.println("positive" + "-" + a[i]);
            }
        }
    }
}
 
PREVIOUS NEXT
Tagged: #Print #positive #numbers #array
ADD COMMENT
Topic
Name
3+8 =