28 lines
533 B
C
28 lines
533 B
C
//
|
|
// Created by bruno on 12/18/23.
|
|
//
|
|
|
|
#include "for.h"
|
|
#include "stdio.h"
|
|
|
|
int for_cyklus() {
|
|
int target;
|
|
|
|
printf("Do akého čísla počítať?");
|
|
scanf("%d", &target);
|
|
printf("Zadal si číslo %d.\n", target);
|
|
printf("Cyklus FOR:\n");
|
|
for (int i = 0; i <= target; i++) {
|
|
if (i % 2 == 1) {
|
|
printf("%d\n", i);
|
|
}
|
|
}
|
|
printf("\nCyklus WHILE:\n");
|
|
int i = 0;
|
|
while (i <= target) {
|
|
if (i % 2 == 1) {
|
|
printf("%d\n", i);
|
|
}
|
|
i++;
|
|
}
|
|
} |