Skip to content

Given an array of integers, calculate the fractions of its elements that are positive, negative, and are zeros. Print the decimal value of each fraction on a new line.

License

Notifications You must be signed in to change notification settings

LNMA/problem-Plus_Minus

Repository files navigation

problem-Plus_Minus

1-Review:

Given an array of integers, calculate the fractions of its elements that are positive, negative, and are zeros. Print the decimal value of each fraction on a new line.

2-Explanation:

There are 3 positive numbers, 2 negative numbers, 1 and zero in the array. The proportions of occurrence are positive: 3/6 = 0.500000, negative:2/6 = 0.333333 and zeros: 1/6 = 0.166667 .

3-Input Format

The first line contains an integer, denoting the size of the array. The second line contains space-separated integers describing an array of numbers .

4-Output Format

You must print the following 3 lines:

  1. A decimal representing of the fraction of positive numbers in the array compared to its size.
  2. A decimal representing of the fraction of negative numbers in the array compared to its size.
  3. A decimal representing of the fraction of zeros in the array compared to its size

About

Given an array of integers, calculate the fractions of its elements that are positive, negative, and are zeros. Print the decimal value of each fraction on a new line.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages