Warning: mkdir(): No space left on device in /var/www/hottg/post.php on line 59

Warning: file_put_contents(aCache/aDaily/2025-07-22/post/C_Codings/--): Failed to open stream: No such file or directory in /var/www/hottg/post.php on line 72
135. Sieve of Eratosthenes : An algorithm to generate all the prime numbers within an range. @C Language 👨‍💻
TG Telegram Group & Channel
C Language 👨‍💻 | United States America (US)
Create: Update:

135. Sieve of Eratosthenes : An algorithm to generate all the prime numbers within an range.

#include <stdio.h>
#define size 1000

int main (void)
{
int n;
scanf("%d",&n);
int arr[size]={0};

for(int i=2;i*i<=n;i++)
{
for(int j=i;i*j<=n;j++)
{
arr[i*j]=1;
}
}
for(int i=2;i<=n;i++)
{
if(!arr[i])
printf("%d ",i);
}
return 0;
}
#program_by : @freakyLuffy

135. Sieve of Eratosthenes : An algorithm to generate all the prime numbers within an range.

#include <stdio.h>
#define size 1000

int main (void)
{
int n;
scanf("%d",&n);
int arr[size]={0};

for(int i=2;i*i<=n;i++)
{
for(int j=i;i*j<=n;j++)
{
arr[i*j]=1;
}
}
for(int i=2;i<=n;i++)
{
if(!arr[i])
printf("%d ",i);
}
return 0;
}
#program_by : @freakyLuffy


>>Click here to continue<<

C Language 👨‍💻




Share with your best friend
VIEW MORE

United States America Popular Telegram Group (US)


Warning: Undefined array key 3 in /var/www/hottg/function.php on line 115

Fatal error: Uncaught mysqli_sql_exception: Too many connections in /var/www/db.php:16 Stack trace: #0 /var/www/db.php(16): mysqli_connect() #1 /var/www/hottg/function.php(212): db() #2 /var/www/hottg/function.php(115): select() #3 /var/www/hottg/post.php(351): daCache() #4 /var/www/hottg/route.php(63): include_once('...') #5 {main} thrown in /var/www/db.php on line 16