Question: Help With Coding Problem https://www.hackerrank.com/challenges/plus-minus/problem Please ignore the array [] suggested on hackerrank. Use for loops instead. For example, you can use the following template:

Help With Coding Problem

https://www.hackerrank.com/challenges/plus-minus/problem

Please ignore the array [] suggested on hackerrank. Use for loops instead. For example, you can use the following template:

import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*;

public class Solution {

public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); // define variables here int pos = 0; int zero = 0; int neg = 0;

for (int i = 0; i < n; i++) { // write main logic here } //print out the percentage, (double) will force the results to be double precision System.out.println(pos / (double) n); System.out.println(neg / (double) n); System.out.println(zero / (double) n); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!