Saturday 5 July 2014

C++ program to find cube of a number using function


Here is a C++ program to find cube of a number using function


 SOURCE CODE OUTPUT
#include<iostream>
using namespace std;
int cube(int);
int main()
{
    int a;
    cout<<"Enter number : ";
    cin>>a;
    cout<<"Cube = "<<cube(a);
    return 0;
}
int cube(int x)
{
    return x*x*x;
}

Any questions regarding to program please write in comments.

No comments:

Post a Comment