/*
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. 创建一个Spring的HelloWorld程序

    Spring IOC IOC指的是控制反转,把对象的创建.初始化.销毁等工作都交给Spring容器.由spring容器来控制对象的生命周期.下图能够说明我们传统创建类的方式和使用Spring之后的差别 ...

  2. poj_2352树状数组

    因为y已经排好序了,用x坐标建立一维树状数组 #include<iostream> #include<cstdio> #include<cstring> using ...

  3. 1.Windows7下安装与破解IntelliJ IDEA2017

    转自:https://www.cnblogs.com/justuntil/p/7245170.html IDEA 全称 IntelliJ IDEA,是Java语言开发的集成环境,IntelliJ在业界 ...

  4. django 笔记12 session

    第一步写好函数,然后生成数据库session表 python manage.py makemigrations python manage.py migrate session原理: .Session ...

  5. [AtCoder Regular Contest 096 E] Everything on It 解题报告 (第二类斯特林数+容斥原理)

    题目链接:https://arc096.contest.atcoder.jp/tasks/arc096_c Time limit : 4sec / Memory limit : 512MB Score ...

  6. C#篇(三)——函数传参之引用类型和值类型

    首先应该认清楚在C#中只有两种类型: 1.引用类型(任何称为"类"的类型) 2.值类型(结构或枚举) 先来认识一下引用类型和值类型的区别: 函数传参之引用类型: 1.先来一个简单的 ...

  7. 什么是Node.js?

     Node.js是一个基于Chrome JavaScript运行时建立的平台, 用于方便地搭建响应速度快.易于扩展的网络应用.Node.js 使用事件驱动, 非阻塞I/O 模型而得以轻量和高效,非常适 ...

  8. [BJWC2012]冻结 分层图最短路

    昨晚飞行路线之后,这道题就应该能一眼切了 题目当然也不难,跑一遍分层图最短路即可 Code: #include<cstring> #include<algorithm> #in ...

  9. yii2.0中使用jquery

    我们都知道 yii 框架是组件式开发的,使用 jquery 也是非常简单的.只需要注册一下就可以使用非常简单的 jquery 代码了! <?php $this->beginBlock('s ...

  10. vue引入iconfont阿里字体图标库以及报错解决

    下载阿里的字体图标库文件,放在\src\assets\font文件夹下面. 安装style-loader,css-loader和file-loader (或url-loader)  ,记得--save ...