The C programming Language Second Editing

The C programming Language Second Editing
(xu bao wen)

1-3: ANSWER

#include <stdio.h>

#define LOWER 0
#define UPPER 300
#define STEP 20

int main(int argc, char const *argv[])
{
	
	int fahr;

	printf("***temerature meter***\n");

	for (fahr = LOWER; fahr <= UPPER; fahr = fahr + STEP) {
	printf("%3d %6.1f\t\n", fahr ,(5.0/9.0)*(fahr - 32));
	}
	return 0;
}

The C programming Language Second Editing
1-4:Answer

#include <stdio.h>

#define LOWER -17.8
#define UPPER 148.9
#define STEP  11.1

int main(int argc, char const *argv[])
{
	
	float celsius;


	printf("celsius trans fahr temperature meter\n");
	for (celsius = LOWER; celsius <= UPPER; celsius = celsius + STEP)
	printf("%6.1f %6.0f\n", celsius, (32 + 9*celsius/5));

	return 0;
}

The C programming Language Second Editing

上一篇:2021-10-06


下一篇:浙大版《C语言程序设计(第3版)》题目集 练习2-4 温度转换 (5 分)