Advertisement
2607

Untitled

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