Bug: An elusive creature living in a program that makes it incorrect. The activity of "debugging", or removing bugs from a program, ends when people get tired of doing it, not when the bugs are removed.

You’re given an array containing integer values. You need to print the fraction of count of positive numbers, negative numbers and zeroes to the total numbers. Print the value of the fractions correct to 3 decimal places.

Input Format

First line contains N, which is the size of the array.
Next line contains N integers A1,A2,A3,⋯,An, separated by space.

Constraints 1≤N≤100 −100≤Ai≤100

Output Format

Output three values on different lines equal to the fraction of count of positive numbers, negative numbers and zeroes to the total numbers respectively correct to 3 decimal places.

Sample Input

6
-4 3 -9 0 4 1

Sample Output

0.500

0.333

0.167

class Plus_minus_hackerrank
{
static void Main(string[] args)
{
int N = Convert.ToInt16(Console.ReadLine());
decimal positiveNum = 0, negativeNum = 0, zeroNum = 0, temp = (decimal)1 / N;

foreach (string ch in Console.ReadLine().Split(‘ ‘))
{
Int16 num = Convert.ToInt16(ch);
if (num > 0)
{
++positiveNum;
}
else if (num < 0)
{
++negativeNum;
}
else if (num == 0)
{
++zeroNum;
}
}

I'm working as Project Lead in Oracle. I'm mainly into Microsoft technologies but quite interested in Java and C. I'm not a professional blogger, whatever I find interesting I read it and write a blog post just to share my understanding.
View all posts by Sunil Kumar