projects
/
cProgLang
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
121094b
)
Added exercise 1-5
author
Cian Bagshaw
<cian@cianb.xyz>
Sun, 4 Dec 2022 11:02:40 +0000
(11:02 +0000)
committer
Cian Bagshaw
<cian@cianb.xyz>
Sun, 4 Dec 2022 11:02:40 +0000
(11:02 +0000)
1/5.c
[new file with mode: 0644]
patch
|
blob
diff --git a/1/5.c
b/1/5.c
new file mode 100644
(file)
index 0000000..
eb28376
--- /dev/null
+++ b/
1/5.c
@@ -0,0
+1,14
@@
+/*
+ Exercise 1-5. Modify the temperature conversion program to print the table in
+ reverse order, that is, from 300 degrees to 0.
+ ===
+*/
+
+#include <stdio.h>
+
+int main () {
+ float fahr;
+ for (fahr=300; fahr>=0; fahr-=20) {
+ printf("%3.0f %6.1f\n", fahr, (5.0/9.0) * (fahr-32.0));
+ }
+}