Skip to content

Commit 1626848

Browse files
committed
ex1_4: integer to float and tried Makefile by myself
q . z
1 parent c812904 commit 1626848

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

chapterone/ex1_4/Makefile

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CC = gcc
2+
TARGET = ex1_4
3+
4+
$(TARGET) : $(TARGET).c
5+
$(CC) $(TARGET).c -o $(TARGET)
6+
7+
clean :
8+
rm $(TARGET)

chapterone/ex1_4/ex1_4.c

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <stdio.h>
2+
3+
int main()
4+
{
5+
//variable declaration
6+
float fahr, celsius;
7+
float lower, upper, step;
8+
9+
lower = 0;
10+
upper = 300;
11+
step = 20;
12+
13+
fahr = lower;
14+
15+
printf("화씨\t 섭씨\n");
16+
while(fahr <= upper)
17+
{
18+
celsius = 5 * (fahr-32) /9;
19+
printf("%f\t%f\n", fahr, celsius);
20+
fahr = fahr + step;
21+
}
22+
}

0 commit comments

Comments
 (0)