Guest User

Untitled

a guest
May 25th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. #include<stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(){
  5.     int n, *t, x, i, j, k, l;
  6.     scanf("%d", &n);
  7.     t=(int*) malloc(x);
  8.     for(i=0; i<n; i++){
  9.         scanf("%d", &x);
  10.         for(j=2; j<=x; j++) t[j]=0;
  11.         for(k=2; k*k<=x; k++){
  12.             if(t[k]!=0) continue;
  13.             else{
  14.                 for(l=2*k; l<=x; l=l+k) t[l]=1;
  15.             }
  16.             if(t[x]==1) break;
  17.         }
  18.         if(t[x]==1) printf("N\n");
  19.         else printf("T\n");
  20.     }
  21.     return 0;
  22. }
Add Comment
Please, Sign In to add comment