home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
vol_200
/
258_01
/
squares.c
< prev
next >
Wrap
Text File
|
1988-03-30
|
512b
|
23 lines
/* Chapter 5 - Program 2 */
main() /* This is the main program */
{
int x,y;
for(x = 0;x <= 7;x++) {
y = squ(x); /* go get the value of x*x */
printf("The square of %d is %d\n",x,y);
}
for (x = 0;x <= 7;++x)
printf("The value of %d is %d\n",x,squ(x));
}
squ(in) /* function to get the value of in squared */
int in;
{
int square;
square = in * in;
return(square); /* This sets squ() = square */
}