//call by value method in c++
#include<iostream.h>
#include<conio.h>
int
cube(int);
void
main()
{
int n;
cout<<"Enter the
number";
cin>>n;
n=cube(n);
cout<<"Cube of the number
is:"<<n;
getch();
}
int
cube(int n)
{
n=n*n*n;
return n;
}
Output
|
C++ program to demonstrate call by value |
No comments:
Post a Comment