Skip to content

Commit

Permalink
ex1_4: integer to float and tried Makefile by myself
Browse files Browse the repository at this point in the history
q
.
z
  • Loading branch information
notypicalus committed Sep 12, 2019
1 parent c812904 commit 1626848
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
8 changes: 8 additions & 0 deletions chapterone/ex1_4/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CC = gcc
TARGET = ex1_4

$(TARGET) : $(TARGET).c
$(CC) $(TARGET).c -o $(TARGET)

clean :
rm $(TARGET)
22 changes: 22 additions & 0 deletions chapterone/ex1_4/ex1_4.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <stdio.h>

int main()
{
//variable declaration
float fahr, celsius;
float lower, upper, step;

lower = 0;
upper = 300;
step = 20;

fahr = lower;

printf("화씨\t 섭씨\n");
while(fahr <= upper)
{
celsius = 5 * (fahr-32) /9;
printf("%f\t%f\n", fahr, celsius);
fahr = fahr + step;
}
}

0 comments on commit 1626848

Please sign in to comment.