mirror of
https://github.com/krislamo/knrc.git
synced 2024-11-10 00:30:35 +00:00
Exercise 1-4. print Celsius to Fahrenheit table
This commit is contained in:
parent
c9506f8dcb
commit
93126a8207
11
03-celsius-to-fahrenheit.c
Normal file
11
03-celsius-to-fahrenheit.c
Normal file
@ -0,0 +1,11 @@
|
||||
#include <stdio.h>
|
||||
|
||||
/* print Celsius-Fahrenheit table */
|
||||
int main()
|
||||
{
|
||||
int cels;
|
||||
|
||||
printf("Celsius\t\tFahrenheit\n==========================\n");
|
||||
for (cels = 0; cels <= 300; cels = cels + 20)
|
||||
printf("%3d\t\t%10.0f\n", cels, (9.0/5.0)*cels+32);
|
||||
}
|
5
Makefile
5
Makefile
@ -1,4 +1,4 @@
|
||||
all: hello mathvars
|
||||
all: hello mathvars c2f
|
||||
|
||||
hello: 01-hello-world.c
|
||||
gcc -o ./bin/01-helloworld 01-hello-world.c
|
||||
@ -6,5 +6,8 @@ hello: 01-hello-world.c
|
||||
mathvars: 02-vars-and-math.c
|
||||
gcc -o ./bin/02-mathvars 02-vars-and-math.c
|
||||
|
||||
c2f: 03-celsius-to-fahrenheit.c
|
||||
gcc -o ./bin/03-c2f 03-celsius-to-fahrenheit.c
|
||||
|
||||
clean:
|
||||
$(RM) ./bin/*-*
|
||||
|
Loading…
Reference in New Issue
Block a user