home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C Programming Starter Kit 2.0
/
SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso
/
tyc
/
list5_1.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-16
|
481b
|
25 lines
/* Demonstrates a simple function */
#include <stdio.h>
long cube(long x);
long input, answer;
main()
{
printf("Enter an integer value: ");
scanf("%d", &input);
answer = cube(input);
/* Note: %ld is the conversion specifier for */
/* a long integer */
printf("\n\nThe cube of %ld is %ld.", input, answer);
}
long cube(long x)
{
long x_cubed;
x_cubed = x * x * x;
return x_cubed;
}