Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi, how would I go about writing this? The general idea makes perfect sense and

ID: 3909459 • Letter: H

Question

Hi, how would I go about writing this? The general idea makes perfect sense and I’ve written out code for this but I’m not sure if my method is ideal. The program language is C.

Function Parameters You will be writing a program that reads three positive integers and prints out the minimum of the three integers entered and the sum of the cubes of the numbers from 1 to the minimum. The program includes two functions, Minimum and Sum of_cubes. Minimum computes the minimum of the values passed to it. Sum Of cubes computes the sum of the cubes of the integers from 1 to the parameter passsed to it. For example, if the input is 12, 3, and 5, your output should looks like: Input three positive integer values 1235 The minimum of 12, 3, and 5 is 3 The sum of the cubes from 1 to 3 is 36. Note that 1-cubed + 2-cubed 3-cubed is 36

Explanation / Answer

#include <stdio.h>
#include <stdlib.h>

int main()
{
int z, y, x, m;
printf("Input three positive integer values: ");;
scanf("%d %d %d", &x, &y, &z);
// If x is greater than y then min is y
if ( x > y )
m = y;
// else then min is x
else
m = x;
// If x is greater than z then min is z
if ( x > z )
m = z;
else
// else then min is x
m = x;
// If y is greater than z then min is z
if ( y > z )
m = z;
else
// else then min is y
m = y;
printf("The minimum of %d, %d and %d is %d ", x, y, z, m);
int cubeSum = 0, i;
// Iterating the loop from 1 to 3
for(i = 1; i < = 3; i++)
cubeSum += (i * i * i);
printf("The sum of cubes from 1 to 3 is %d", cubeSum);
return 0;
}

**Comment for any further queries.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote