Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include #include #include using namespace std; int main() { srand(time(NULL)); int intnum_1, intnum_2, intnum_3; float avg_value; //Write code to place number as per specifications

#include #include #include #include using namespace std; int main() { srand(time(NULL)); int intnum_1, intnum_2, intnum_3; float avg_value; //Write code to place number as per specifications into intnum_1 intnum_2 = rand() % 21; intnum_3 = rand() % 21; print_numbers(intnum_1, intnum_2, intnum_3); avg_value = get_average_value(intnum_1, intnum_2, intnum_3); cout << fixed << setprecision(1); cout << "Average value = " << avg_value << endl; return 0; }

Lines 10 and 11 declare 3 int variables and 1 float variables. The 3 int variables are populated using random number generation. In order to complete this program, complete these steps:

Write a loop to ensure that intnum_1 is

Between 1 and 50

It is a multiple of 6

Implement the print_numbers function by:

Defining the function

Coding a function prototype

Implement the get_average_value function by:

Defining the function

Coding a function prototype

Sample output

#1 (multiple of 6)=30, #2=12, #3=1

Average value of first 2 numbers = 14.3

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

The Structure Of The Relational Database Model

Authors: Jan Paredaens ,Paul De Bra ,Marc Gyssens ,Dirk Van Gucht

1st Edition

3642699588, 978-3642699580

More Books

Students also viewed these Databases questions

Question

1. Explain how business strategy affects HR strategy.

Answered: 1 week ago