From e99071597daa31add760a34b6c5d05439046fa90 Mon Sep 17 00:00:00 2001 From: Matus Tokarcik Date: Thu, 22 Feb 2024 18:29:45 +0100 Subject: [PATCH] du1 --- du1/program.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/du1/program.c b/du1/program.c index e69de29..59af2fa 100644 --- a/du1/program.c +++ b/du1/program.c @@ -0,0 +1,29 @@ +#include +#include + +int main() { + int c; + char output; + int count_line = 0; + + while ((c = getchar()) != EOF) { + if (islower(c)) { + output = toupper(c); + } + else if (isupper(c)) { + output = tolower(c); + } + else if (isgraph(c) || c == ' ') { + output = c; + } + else { + output = c; + } + putchar(output); + if (c == '\n') { + count_line++; + } + } + // printf("Number of lines: %d\n", count_line); + return 0; +}