school/for.c

24 lines
446 B
C
Raw Normal View History

2023-12-18 15:36:37 +01:00
//
// Created by bruno on 12/18/23.
//
#include "for.h"
#include "stdio.h"
int for_cyklus(){
int target;
2023-12-18 15:46:42 +01:00
2023-12-18 15:36:37 +01:00
printf("Do akého čísla počítať?");
scanf("%d", &target);
2023-12-18 15:46:42 +01:00
printf("Zadal si číslo %d.\n", target);
printf("Cyklus FOR:\n");
for(int i = 0; i <= target; i++){
printf("%d\n", i);
}
printf("Cyklus WHILE:\n");
int i = 0;
while(i <= target){
2023-12-18 15:36:37 +01:00
printf("%d\n", i);
2023-12-18 15:46:42 +01:00
i++;
2023-12-18 15:36:37 +01:00
}
}