/*-------------------------------------------------------------------+
| Copyright (c) 1996, SAS Institute Inc. |
| Unpublished - All Rights Reserved |
| S A S / C S A M P L E |
| |
| NAME: FTOC |
| LANGUAGE: C |
| PURPOSE: Simple C program from page 8 of the Kernighan and |
| Ritchie text. |
| INPUT/OUTPUT: Output is a table of temperatures on both the |
| Fahrenheit and Celsius scales. |
| MVS - |
| COMPILE, LINK, EXECUTE: SUBMIT prefix.SAMPLE.AUX(FTOC) |
| where "prefix" is the installation defined high-level|
| qualifier for the SAS/C product. |
| TSO - |
| COMPILE: LC370 CLIST |
| LINK: CLK370 CLIST |
| EXECUTE: CALL your.load.lib(FTOC) |
| CMS - |
| COMPILE: LC370 FTOC |
| LINK: CLINK FTOC (GENMOD |
| EXECUTE: FTOC |
+-------------------------------------------------------------------*/
#eject
#include <stdio.h>
void main()
{
int lower, upper, step;
float fahr, celsius;
lower = 0; /* lower limit of temperature table */
upper = 300; /* upper limit */
step = 20; /* step size */
fahr = lower;
while (fahr <= upper) {
celsius = (5.0/9.0) * (fahr-32.0);
printf("%4.0f %6.1f\n", fahr, celsius);
fahr = fahr + step;
}
}
|