Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write a program that reads a series of integers, stopping when the user enters the value zero. The user should print out the number of

write a program that reads a series of integers, stopping when the user enters the value zero. The user should print out the number of values read and the maximum and minimum values seen. You can assume there will always be at least one number entered.

My code:

#include #include int main (void){

int i = 0; int value[20]; int max = 0; int min = 0;

for (i = 0; value[i]!= 0; ++i){

scanf("%d", &value[i]);

if (value[i] > value[i+1]){

max = value[i]; } else { max = value[i+1]; } if (value[i] < value[i]){ min = value[i]; } else { min = value[i+1];

} } printf("Maximum Value is : %d ", max); printf("Minimum Value is : %d ", min); printf("Count of numbers is : %d ", i); return 0; }

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

Step: 3

blur-text-image

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

Database Machine Performance Modeling Methodologies And Evaluation Strategies Lncs 257

Authors: Francesca Cesarini ,Silvio Salza

1st Edition

3540179429, 978-3540179429

More Books

Students also viewed these Databases questions

Question

dy dx Find the derivative of the function y=(4x+3)5(2x+1)2.

Answered: 1 week ago

Question

Draw and explain the operation of LVDT for pressure measurement

Answered: 1 week ago

Question

Explain the service recovery paradox.

Answered: 1 week ago