diff --git a/du1/program.c b/du1/program.c index ceace3f..5c38cb3 100644 --- a/du1/program.c +++ b/du1/program.c @@ -1,9 +1,12 @@ #include -int main(){ + + + +int main() { char word; - + int i = 0; for (int count = 0; (word = getchar()) != EOF;) { if (word >= 'a'&&word <= 'z') { word -= 32; @@ -12,15 +15,18 @@ int main(){ word += 32; } if (word == '\n') { - count++; - for (int i = 0; i <= count; i++) { - printf("\n"); + while (word + i == '\n') { + count++; + i++; } - printf("Počet riadkov: %d", count); + i = 0; + printf("\nPočet riadkov: %d", count); + count = 0; } putchar(word); - - } - + } return 0; + } + +