| Description
Shows a simple function
in C which takes a number , cubes
it and the returns the result .
Code
#include <stdio.h>
long cubed(long x);
long input,result;
main()
{
printf("Please enter an integer
value.\n");
scanf("%d",&input);
result = cubed(input);
printf("The cube of %ld is %ld
.\n",input ,result);
return 0;
}
long cubed(long x)
{
long xcubed;
xcubed = x * x * x;
return xcubed;
}
Information
tested using Visual
C++ 6 , LCC win 32
|