From 4203df9d14b48a6634a58873dd0629dca32b4136 Mon Sep 17 00:00:00 2001 From: ak643du Date: Mon, 22 Apr 2024 18:04:53 +0200 Subject: [PATCH] Initialization --- cv10/program.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cv10/program.c b/cv10/program.c index fc33e68..c4f4a8f 100644 --- a/cv10/program.c +++ b/cv10/program.c @@ -8,6 +8,7 @@ int main() { int max_students, num_accepted = 0; char names[MAX_STUDENTS][NAME_SIZE]; char temp_name[NAME_SIZE]; + int num_rejected = max_students; scanf("%d", &max_students); if (max_students <= 0 || max_students > MAX_STUDENTS) { @@ -40,10 +41,14 @@ int main() { printf("Prijati studenti:"); for (int i = 0; i < num_accepted; i++) { printf("%s", names[i]); + if (i < num_accepted - 1) { + printf("\n"); + } } + num_rejected -= num_accepted; } - if (num_accepted < max_students) { + if (num_rejected > 0) { printf("Neprijati studenti:"); for (int i = num_accepted; i < max_students; i++) { printf("%s", names[i]);