Mine
public text v1 · immutable/* File: composites.c */
#include <stdio.h>
#include <math.h> /*Header file for sqrt function*/
#define N 30
main()
{
int n,i,l,k,j;
n=3; // o epomenos prwtos
i=3; // xrhsimopoieitai gia ton elegxo prwtou
k=3; // o arxikos prwtos arithmos
l=1; // plhthos pou thelw (1,3,5,..)
j=1; // plhthos metaxu prwtwn
while(l<=N)
{
while(j!=l||l==1)
{
while((n%i!=0&&i<=(double)sqrt(n))||n==i) // n==i??giati?
{
i=i+2;
}
if(n%i!=0&&i>(double)sqrt(n))
{
if(n-k-1==l)
{
printf("first %d consecutive composites from %d to %d \n",l,k+1,n-1);
l=l+2;
j=l;
}
}
if(l!=1&&n%i!=0&&i>(double)sqrt(n))
{
k=n;
}
i=3;
n=n+2;
}
n=3;
}
getchar();
}