SHARE
TWEET

Untitled

a guest Oct 13th, 2017 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. bool songuyento(int x) {
  4.     if (x == 2 || x == 3) {
  5.         return true;
  6.     }
  7.     for (int i = 2; i <= x / 2; i++) {
  8.         if (x % i == 0) {
  9.             return false;
  10.         }
  11.     }
  12.     return true;
  13. }
  14.  
  15. int main() {
  16.     int n;
  17.     printf("Nhap n: ");
  18.     scanf("%d", &n);
  19.     for (int i = 1; i <= n / 2; i++) {
  20.         if (n % i == 0 && songuyento(i)) {
  21.             printf("%d ", i);
  22.         }
  23.     }
  24.     printf("\n");
  25.     getchar();
  26.     return 0;
  27. }
RAW Paste Data
Top