Question: I have to write a program that reads any number of integer values and determines the mean of positive values and mean of negative values.

I have to write a program that reads any number of integer values and determines the mean of positive values and mean of negative values. It must also display the positions of the following numbers:  From the first positive number read and,  the first negative number read. The stop condition is reading a 0

I've wrote that; but I'm missing some and Im not sure It is good,

float moyennepos, moyenneneg; int valeur, sommepos = 0, sommeneg = 0, cptpos = 0, cptneg = 0; const int nombrevaleur=0;

for (int i = 0; i < nombrevaleur; i++) { Console.Write("Donnez-moi votre valeur {0}: ", i + 1); valeur = int.Parse(Console.ReadLine());

if (valeur > 0) { sommepos = sommepos + valeur; cptpos++; } else if (valeur < 0) { sommeneg = sommeneg + valeur; cptneg++; }

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!