From bc75f881494c5b0335832d8b09df70966bd93ed2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=9E=A5=EC=9B=90?= <wkddnjs3268@ajou.ac.kr> Date: Mon, 3 Aug 2020 16:50:01 +0900 Subject: [PATCH] My printf HW --- hello.c | 13 +++++++++++++ input_data | 1 + output_data | 1 + 3 files changed, 15 insertions(+) create mode 100644 hello.c create mode 100644 input_data create mode 100644 output_data diff --git a/hello.c b/hello.c new file mode 100644 index 0000000..a984106 --- /dev/null +++ b/hello.c @@ -0,0 +1,13 @@ +#include <stdio.h> + +int main() +{ + int a; + fscanf(stdin, "%d", &a); + if (a > 0) + fprintf(stderr, "Error: It is positive\n"); + else + fprintf(stderr, "Error: It is negative\n"); + fprintf(stdout, "Hello, World %-10d\n", a); + return 0; +} diff --git a/input_data b/input_data new file mode 100644 index 0000000..25f412a --- /dev/null +++ b/input_data @@ -0,0 +1 @@ +-200 diff --git a/output_data b/output_data new file mode 100644 index 0000000..b8656e8 --- /dev/null +++ b/output_data @@ -0,0 +1 @@ +This is negative -- GitLab