@@ -0,0 +1,1818 @@
+package algorithms.warmup;%0D%0A%0D%0Aimport java.util.Scanner;%0D%0A%0D%0A/*%0D%0A * Problem Statement: %0D%0A * You're given an array containing integer values. You need to print the%0D%0A * fraction of count of positive numbers, negative numbers and zeroes to the%0D%0A * total numbers. Print the value of the fractions correct to 3 decimal places.%0D%0A * %0D%0A * Input Format: %0D%0A * First line contains N, which is the size of the array.%0D%0A * Next line contains N integers A1,A2,A3,...,AN, separated by space.%0D%0A * %0D%0A * Constraints:%0D%0A * 1 %3C= N %3C= 100%0D%0A * -100 %3C= Ai %3C= 100%0D%0A * %0D%0A * Output Format: %0D%0A * Output three values on different lines equal to the fraction of count of%0D%0A * positive numbers, negative numbers and zeroes to the total numbers%0D%0A * respectively correct to 3 decimal places.%0D%0A * %0D%0A * Sample Input:%0D%0A * 6%0D%0A * -4 3 -9 0 4 1%0D%0A * %0D%0A * Sample Output:%0D%0A * 0.500%0D%0A * 0.333%0D%0A * 0.167%0D%0A */%0D%0Apublic class PlusMinus %7B%0D%0A%0D%0A    public static void main(String%5B%5D args) %7B%0D%0A        Scanner sc = new Scanner(System.in);%0D%0A        %0D%0A        int numElements = sc.nextInt();%0D%0A        %0D%0A        int numPos = 0;%0D%0A        int numNeg = 0;%0D%0A        int numZero = 0;%0D%0A        int num;%0D%0A        %0D%0A        for (int i = 0; i %3C numElements; i++) %7B%0D%0A            num = sc.nextInt();%0D%0A            %0D%0A            if (num %3E 0) %7B%0D%0A                numPos++;%0D%0A            %7D else if (num %3C 0) %7B%0D%0A                numNeg++;%0D%0A            %7D else %7B%0D%0A                numZero++;%0D%0A            %7D%0D%0A        %7D%0D%0A        sc.close();%0D%0A        %0D%0A        double percentPos = (double) numPos / numElements;%0D%0A        double percentNeg = (double) numNeg / numElements;%0D%0A        double percentZero = (double) numZero / numElements;%0D%0A        %0D%0A        System.out.printf(%22%25.3f %25n%22, percentPos);%0D%0A        System.out.printf(%22%25.3f %25n%22, percentNeg);%0D%0A        System.out.printf(%22%25.3f%22, percentZero);%0D%0A    %7D%0D%0A%7D

Add PlusMinus