Restructuring

This commit is contained in:
2024-07-01 13:49:44 +00:00
parent f11b705ef0
commit 8d60e1b905
194 changed files with 1296 additions and 112 deletions

View File

@ -0,0 +1,10 @@
title: Sieve of Eratosthenes
url: http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
desc:Generate primes from 2 to 100
solution: Do i need to say more
solutions:
solve.c:
desc: ANSI C solution (Tested with TCC)
language: c

View File

@ -0,0 +1,22 @@
#include <stdio.h>
void main( )
{
unsigned char primes[100];
int p;
int j;
memset(&primes, 1, 50 );
for( p = 2; p<=10; p++) {
if (primes[p]) {
for(j = p*p; j <= 100; j+= p){
primes[j] = 0;
}
}
}
printf( "Primes:%d\n", sizeof(primes)) ;
for(p=0;p<sizeof(primes);p++) {
if(primes[p]) {
printf( "%d\n",p);
}
}
}