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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started