Advertisement
2607

Untitled

Feb 20th, 2020
395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.26 KB | None | 0 0
  1. #include "stdio.h"
  2.  
  3. int main()
  4. {
  5.     int n;
  6.     int k=3;
  7.     int m=0;
  8.     scanf("%d'", &n);
  9.     printf("1 2 ");
  10.     while(k<=n)
  11.     {
  12.         for(int i =2; i<k; ++i)
  13.         {
  14.             if(k%i==0)
  15.             {
  16.                 m=1;
  17.                 break;
  18.             }      
  19.         }
  20.         if(m==0)
  21.             printf("%d ", k);
  22.         k++;
  23.         m=0;
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement