school/for.c
2023-12-18 15:59:29 +01:00

28 lines
526 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++;
}
}