30.1k views
5 votes
Function Integer cube(Integer num) Return num * num * num End Function Write a main module that contains a statement that passes the value 4 to this function and assigns its return value to the variable result. Write a statement that calls the display module and passes these variables to it.

1 Answer

5 votes

Answer:

#include <iostream>

using namespace std;

int cube(int num)//function cube..

{

return num*num*num;

}

int main() {

int result=cube(4);//result stores the value of cube(4).

cout<<result;//displaying it to the screen.

return 0;

}

Step-by-step explanation:

The above code is in C++ language.The function cube is passed with value 4 and the result of it is stored in the variable result of integer type.Then the result is displayed using the cout. Which is used to print the statement to the output screen.

User MinnuKaAnae
by
5.3k points