mirror of
https://github.com/krislamo/knrc.git
synced 2024-11-14 02:00:35 +00:00
Compare commits
No commits in common. "fe248c5a30276c3485d46e9240743528abf10f52" and "ee5bcb81ceae425cfc9faa5030f1812f2bd24791" have entirely different histories.
fe248c5a30
...
ee5bcb81ce
@ -1,15 +1,11 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define LOWER 0
|
|
||||||
#define UPPER 300
|
|
||||||
#define STEP 20
|
|
||||||
|
|
||||||
/* print Fahrenheit-Celsius table */
|
/* print Fahrenheit-Celsius table */
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
int fahr;
|
int fahr;
|
||||||
|
|
||||||
printf("Fahrenheit\tCelsius\n=======================\n");
|
printf("Fahrenheit\tCelsius\n=======================\n");
|
||||||
for (fahr = UPPER; fahr >= LOWER; fahr = fahr - STEP)
|
for (fahr = 0; fahr <= 300; fahr = fahr + 20)
|
||||||
printf("%3d\t\t%7.1f\n", fahr, (5.0/9.0)*(fahr-32));
|
printf("%3d\t\t%7.1f\n", fahr, (5.0/9.0)*(fahr-32));
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define LOWER 0
|
|
||||||
#define UPPER 300
|
|
||||||
#define STEP 20
|
|
||||||
|
|
||||||
/* print Celsius-Fahrenheit table */
|
/* print Celsius-Fahrenheit table */
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
int cels;
|
int cels;
|
||||||
|
|
||||||
printf("Celsius\t\tFahrenheit\n==========================\n");
|
printf("Celsius\t\tFahrenheit\n==========================\n");
|
||||||
for (cels = LOWER; cels <= UPPER; cels = cels + STEP)
|
for (cels = 0; cels <= 300; cels = cels + 20)
|
||||||
printf("%3d\t\t%10.0f\n", cels, (9.0/5.0)*cels+32);
|
printf("%3d\t\t%10.0f\n", cels, (9.0/5.0)*cels+32);
|
||||||
}
|
}
|
||||||
|
@ -145,10 +145,3 @@ https://github.com/krislamo/knrc/commit/93126a8207ba83e3712bbab7b1e54548761a5fa1
|
|||||||
https://github.com/krislamo/knrc/blob/93126a8207ba83e3712bbab7b1e54548761a5fa1/03-celsius-to-fahrenheit.c[(Source)]
|
https://github.com/krislamo/knrc/blob/93126a8207ba83e3712bbab7b1e54548761a5fa1/03-celsius-to-fahrenheit.c[(Source)]
|
||||||
|
|
||||||
This is a simple little solution for a Celsius to Fahrenheit table.
|
This is a simple little solution for a Celsius to Fahrenheit table.
|
||||||
|
|
||||||
Exercise 1-5. print the table in reverse order
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
https://github.com/krislamo/knrc/commit/588969b09fabab1e91ff4f4b1c37e87fc23cf76b[(Diff)]
|
|
||||||
https://github.com/krislamo/knrc/blob/588969b09fabab1e91ff4f4b1c37e87fc23cf76b/02-vars-and-math.c[(Source)]
|
|
||||||
|
|
||||||
Move some numbers around to reverse the table.
|
|
||||||
|
Loading…
Reference in New Issue
Block a user