/*
Write a program to print the corresponding Celsius to Fahrenheit table.
*/ #include <stdio.h> /* print Celsius-Fahrenheit table for celsius = 0, 20, ..., 300; floating-point
version */
main()
{
float fahr, celsius;
int lower, upper, step; lower = 0; /* lower limit of temperature table */
upper = 300; /* upper limit */
step = 20; /* step size */ printf("Celsius Fahr\n");
celsius = lower;
while (celsius <= upper)
{
fahr = (9.0 * celsius) / 5.0 + 32.0;
printf("%3.0f %6.1f\n", celsius, fahr);
celsius += step;
}
} /* Output: Celsius Fahr
0 32.0
20 68.0
40 104.0
60 140.0
80 176.0
100 212.0
120 248.0
140 284.0
160 320.0
180 356.0
200 392.0
220 428.0
240 464.0
260 500.0
280 536.0
300 572.0
Press any key to continue . . . */

C - The C Answer (2nd Edition) - Exercise 1-4的更多相关文章

  1. C - The C Answer (2nd Edition) - Exercise 1-7

    /* Write a program to print the value of EOF. */ #include <stdio.h> main() { printf("EOF ...

  2. C - The C Answer (2nd Edition) - Exercise 1-2

    /* Experiment to find out what happens when printf's argument string contains \c, where c is some ch ...

  3. C - The C Answer (2nd Edition) - Exercise 1-1

    /* Run the "hello, world" program on your system. Experiment with leaving out parts of the ...

  4. C - The C Answer (2nd Edition) - Exercise 1-16

    /* Revise the main routine of the longest-line program so it will correctly print the length of arbi ...

  5. C - The C Answer (2nd Edition) - Exercise 1-8

    /* Write a program to count blanks, tabs, and newlines. */ #include <stdio.h> /* count blanks, ...

  6. C - The C Answer (2nd Edition) - Exercise 1-5

    /* Modify the temperature conversion program to print the table in reverse order, that is, from 300 ...

  7. C - The C Answer (2nd Edition) - Exercise 1-15

    /* Rewrite the temperature conversion program of Section 1.2 to use a function for conversion. */ #i ...

  8. C - The C Answer (2nd Edition) - Exercise 1-12

    /* Write a program that prints its input one word per line. */ #include <stdio.h> #define IN 1 ...

  9. C - The C Answer (2nd Edition) - Exercise 1-6

    /* Verify that the expression getchar() != EOF is 0 or 1. */ #include <stdio.h> main() { int c ...

随机推荐

  1. Logical Operators (Transact-SQL)

    https://docs.microsoft.com/en-us/sql/t-sql/language-elements/logical-operators-transact-sql Logical ...

  2. poj--1703--Find them, Catch them(并查集巧用)

    Find them, Catch them Time Limit: 1000MS   Memory Limit: 10000KB   64bit IO Format: %I64d & %I64 ...

  3. Linux-php7安装redis

    Linux-php7安装redis 标签(空格分隔): 未分类 安装redis服务 1 下载redis cd /usr/local/ 进入安装目录 wget http://download.redis ...

  4. Pycharm在创建py文件时,如何自动添加默认文件头注释?

    PyCharm是一款很好用的编写Python工程的IDE,用PyCharm创建一个Python文件或者向工程添加一个.py文件时,为了更好的使所编写的代码在各操作环境更好的运行,我们往往需要在.py文 ...

  5. java9新特性-2-安装与官网说明

    1.jdk 9的下载 http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html         下载安 ...

  6. KafkaProducer的整体逻辑

    概述 KafkaProducer是用户向kafka servers发送消息的客户端.官网上对producer的记载如下: Kafka所有的节点都可以应答metadata的请求,这些metadata中包 ...

  7. 自动关闭Messbox

    /// <summary> /// 自动关闭Messbox /// </summary> public class MessageBoxAutoClose { System.T ...

  8. vuejs keep-alive

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  9. 最小生成树(MST) prim() 算法 kruskal()算法 A - 还是畅通工程

    某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离. 省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公 ...

  10. CF718C Sasha and Array(线段树维护矩阵)

    题解 (不会矩阵加速的先去学矩阵加速) 反正我想不到线段树维护矩阵.我太菜了. 我们在线段树上维护一个区间的斐波那契的列矩阵的和. 然后询问时提取每个符合题意列矩阵的答案项(不是列矩阵存了两项吗,一个 ...