Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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