Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
473 B
2
Indexable
#include <stdio.h>
int main()
{
    int x,m,k,n;
    scanf("%d",&n);
    int flag=0;
    for (int i = 1; i <= n; i++)
    {
        if (i==1)
        {
            flag =1;
        }
        for (int j = 2; j <= i/2; ++j)
        {
            if (i%j==0)
            {
                flag= 1;
                break;
            }

        }
        if (flag==0)
        {
            printf("%d ",i);
        }




    }

    return 0;
}