Question: 1 . 2 9 LAB: Variables / Assignments: Simple statistics Part 1 Given 3 integers, output their average and their product, using integer arithmetic. Ex:

1.29 LAB: Variables/Assignments: Simple statistics
Part 1
Given 3 integers, output their average and their product, using integer arithmetic.
Ex: If the input is:
10205
the output is:
111000
Submit the above for grading. Your program will fail the test cases (which is expected), until you complete part 2 below but check that you are getting the correct average and product using integer division.
Part 2
Using the same 3 integers, output the average and product, using floating-point arithmetic.
Output all floating-point numbers with five digits after the decimal point, which can be achieved as follows:
Put x to output with 5 decimal places
Ex: If the input is:
10205
the first line of output uses integer arithmetic and the second line output uses floating-point arithmetic:
11100011.666671000.00000
the current coral code i do have is
// Declare variables at the top
integer num1
integer num2
integer num3
integer average
integer product
// Input values
num1= Get next input
num2= Get next input
num3= Get next input
// Calculate average and product
average =(num1+ num2+ num3)/3
product = num1* num2* num3
// Output results
Put average to output
Put "" to output
Put product to output
Put "
" to output
// Declare variables for floating-point numbers at the top
float f_num1
float f_num2
float f_num3
float f_average
float f_product
// Input values
f_num1= num1
f_num2= num2
f_num3= num3
// Calculate average and product
f_average =(f_num1+ f_num2+ f_num3)/3.0
f_product = f_num1* f_num2* f_num3
// Output results with some added space to match expected format
Put f_average to output
Put "" to output
Put f_product to output
I am attempting to get their answers expected i am just stuck on some of the code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!