This commit is contained in:
2025-02-05 07:54:41 +03:00
parent 4e7fa1b23f
commit 0b7e3b6cb0
6 changed files with 108 additions and 0 deletions

View File

@ -0,0 +1,21 @@
#include <stdio.h>
int main(void) {
puts("Show all prime numbers until: ");
int i;
if(scanf("%d", &i) != 1 || i < 2) {
puts("ERROR, entered integer NOT valid!");
}
for(int y = 2; y < i; y++) {
int counter = 0;
for(int a = 2; a < y; a++) {
if(y % a == 0) {
counter = 1;
}
}
if (!counter) {
printf("%d\t", y);
}
}
}