Category : C Source Code
Archive   : C-TUTOR.ZIP
Filename : FLOATSQ2.C

 
Output of file : FLOATSQ2.C contained in archive : C-TUTOR.ZIP
/* Chapter 5 - Program 7 */
#include "stdio.h" /* Prototypes for standard Input/Outputs */

float sqr(float inval);
float glsqr(void);

float z; /* This is a global variable */

main()
{
int index;
float x,y;

for (index = 0;index <= 7;index++){
x = index; /* convert int to float */
y = sqr(x); /* square x to a floating point variable */
printf("The square of %d is %10.4f\n",index,y);
}

for (index = 0; index <= 7;index++) {
z = index;
y = glsqr();
printf("The square of %d is %10.4f\n",index,y);
}
}

float sqr(float inval) /* square a float, return a float */
{
float square;

square = inval * inval;
return(square);
}

float glsqr(void) /* square a float, return a float */
{
return(z*z);
}


  3 Responses to “Category : C Source Code
Archive   : C-TUTOR.ZIP
Filename : FLOATSQ2.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/