(i) Write a function that returns the cube of the integer passed to it. For example cube(2) will
return 8 and
cube(3) will return 27.
#include <iostream>
#include <iomanip>
using namespace std;
long long cube(int num)
{
return num*num*num;
}
int main()
{
int num;
cout<<"Num:";
cin>>num;
cout<<cube(num)<<endl;
return 0;
}
Comments
Leave a comment