Exercise 2: Computing Cubes

Let's compute cubes of variables using functions.

We'll cover the following

Problem Statement

Write a function void computeCubes which:

  • takes three integers num1, num2, num3 as input.
  • computes the cube of all three values.

This function is void type hence doesn’t return any values. How will you get the updated values of num1, num2 and num3?? Hmmmm…

Hint: Thinks in terms of the ​pass by reference method of passing values.

Example

Input:

num1=4,num2=2,num3=5; 

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy