Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void ex2()
- {
- int n;
- int i,j;
- bool primo;
- scanf("%d",&n);
- printf("2\n");
- for (i=3; i<n; i++)
- {
- primo = true;
- if(i%2 == 0)
- {
- primo = false;
- }
- if(primo)
- {
- for (j=3; (j*j)<=i; j+=2)
- {
- if((i%j) == 0)
- {
- primo = false;
- }
- }
- }
- if (primo == true) {
- printf("%d\n",i);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement