Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include int main ( ) { int count = 0 ; double number, sum, mean = 0 ; / / Using Do / While to

#include
int main(){
int count =0;
double number, sum, mean =0;
//Using Do/While to calculate sum, count, and mean
printf("Using a Do/While to calculate statistics
");
do {
printf("Enter a positive number: ");
scanf("%lf", &number);
if (number >0){
sum += number;
count +=1;
mean = sum/count;
}
}
while(number >0.0);
printf("Sum =%.2lf
",sum);
printf("Count =%d
",count);
printf("Mean =%.2lf
",mean);
printf("Thank you!");
return 0;
Add a While loop to calculate the same statistics
Run your program testing for input =1,2,3,4,5,0
Make sure your calculations are accurate.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

More Books

Students also viewed these Databases questions

Question

How does nonverbal communication express cultural values?

Answered: 1 week ago