1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Gala2k [10]
3 years ago
8

Write a function that asks the user to enter integer odd values and prints out on the screen their count, sum, max, min, and ave

rage. The user keep entering odd values till he enters the first even value.
Computers and Technology
1 answer:
vodomira [7]3 years ago
8 0

Answer:

#include<iostream>

using namespace std;

//main function

int main(){

   //initialization

  int counts_Values=0, sum_all_Values=0;

  int max_Value,min_Value;

  float averge_Value;

  int num1;

  //display

   cout<<"Enter the odd values; ";

   cin>>num1;  //store the number

   max_Value=num1;

   min_Value=num1;

   //while loop for run continuously until odd numbers

   while(num1%2 != 0){

       counts_Values++;  //increment count

       sum_all_Values = sum_all_Values + num1;  //calculate sum

       //calculate the maximum value

       if(num1>max_Value){

           max_Value=num1;

       }

       //calculate the minimum value

       if(num1<min_Value){

           min_Value=num1;

       }

       cout<<"Enter the odd values; ";

       cin>>num1;

   }

   //starting value is even, then store average to zero

   if(counts_Values == 0){

       averge_Value=0;

   }else{

       averge_Value = float(sum_all_Values)/counts_Values;

   }

   //display the result

   cout<<"The count is:"<<counts_Values<<endl;

   cout<<"The sum is:"<<sum_all_Values<<endl;

   cout<<"The Max value is:"<<max_Value<<endl;

   cout<<"The Min value is:"<<min_Value<<endl;

    cout<<"The Average value is:"<<averge_Value<<endl;

   return 0;

}

Explanation:

Include the libraries iostream for using the input/output instruction.

Create the main function and declare the variables.

Print the message on the screen using cout instruction and then store the input enter by the user in the variable using the cin instruction.

then, check the number is even using the if-else statement.

if the number is even, then store zero value stored in the max and min value.

otherwise, store that number in min and max value.

take the while loop with a condition, num1%2 != 0 this condition check the number is not even. if the condition true execute the loop other terminate the loop.

After that, increment the count by 1 and take the sum of value.

then, check for maximum if a new number is greater than the number stored in the max_Value then update the max_Value.

same for min value but the condition will change. Check for the minimum if the new number is less than the number store in the min_Value then update the min_Value.

then, again ask the value from the user.

The above process continues again and again until the user does not enter the even value. if the user enters the even value, the loop terminates and then program checks the count value is zero. if zero then the average is zero other calculate the average.

the above check is used to remove the infinite value. because if we divided the sum with zero it becomes infinite.

and finally, display the output on the screen.

You might be interested in
When designing a suitable and safe flexibility training program, you should set reasonable and appropriate goals depending on wh
GalinKa [24]

Answer:

The following steps will help you design a safe and effective stretching program.

Explanation:

1. You will have to follow the ACSM's guidelines used for flexibility training.

2. evaluate your flexibility rate with the "sit-and-reach" test.

3. you have to also apply the basic principles of FITT in designing your own program.

4. have a "range-of-motion" tests performance.

5. make use of SMART guidelines when setting explicit flexibility goals.

7 0
3 years ago
A client is looking to maximize value from its Cloud investments by baselining, profiling, and prioritizing its human capital ne
barxatty [35]

myNav is to be present inn the Accenture software. It aim is to helps companies manage the human, technology and business dimensions of cloud change. The myNav module that will help this client is Cloud Advisor.

Cloud Advisor is simply known to be one of the many modules within the myNav platform. It was set up to handle the difficulties of cloud for digital transformation.

These Advisors are  known worldwide community of technical resources. They have a thorough  knowledge of cloud technologies and practices.

Their mission is to know the trends, regulatory implications, and our clients' needs so as to help them to set goals and create plans to achieve their desired outcome.

Learn more from

brainly.com/question/24918185

3 0
3 years ago
Computer-based networks that trigger actions by sensing changes in the real or digital world are known as: global marketing plat
Gennadij [26K]
It known as the smart systems

It make decision by describing and analyzing the available data in a predictive or adaptive manner thereby performing an efficient and smart actions based on that analysis

A lot of smart systems evolved from micro systems
8 0
3 years ago
Which of the following statements about the continue statement is true?
kotykmax [81]

Answer:

Option (d)

Explanation:

  • The Continue statement is used inside the looping statements.
  • When a Continue statement is encountered inside the loop, it stops executing the current iteration ( it skips the next steps in the current iteration) and goes to the next iteration.
  • It then continues to execute the loop for the next iteration.
  • The continue statement can be used in all the looping structures ( for loop, while loop, do while loop ).
  • The syntax for continue statement is " continue; "
  • Options (a),(b),(c) are wrong options.
  • Option (d) is correct option.
8 0
3 years ago
What is movie viewer, such as quicktime windows media player,an example of
Karo-lina-s [1.5K]
It is called the Databse
5 0
3 years ago
Other questions:
  • 2. Write the binary representation of number 1037.379 in IEEE 754 standard in single precision. Express the result in binary, oc
    7·1 answer
  • An employee is angry with his boss and wants to sabotage the company. To accomplish this he secretly changes some of the values
    7·1 answer
  • The _________ check is a type of hardware control that involves adding a "1" or a "0" to the end of every 8 bit byte such that t
    11·1 answer
  • The code segmentif (speed &lt;= 40)cout &lt;&lt; "Too slow";if (speed &gt; 40 &amp;&amp; speed &lt;= 55)cout &lt;&lt; "Good spee
    11·1 answer
  • What are the three types of programming design?
    15·1 answer
  • Create a class named CarRental that contains fields that hold a renter's name, zip code, size of the car rented, daily rental fe
    13·1 answer
  • What should a password policy contain to reduce a hackers ability to crack the passwords?
    10·1 answer
  • Your textbook discussed a record store example where one user could perform a query to determine which recordings had a track le
    14·1 answer
  • 15. Virus cannot infect files that are saved in i. USB ii. CD-ROMs iii. Memory card iv. All of them​
    14·2 answers
  • The Synonyms submenu offers a list of synonyms for a word. Is it always a good idea to use whatever synonyms are presented on th
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!