Advertisement
RomanczuG

Untitled

Apr 12th, 2017
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdio>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int liczba = 0;
  9.     int dzielnik=0;
  10.     cin >> liczba;
  11.  
  12.     int pierwsza[2];
  13.  
  14.     for(int i = 0 ; i<liczba ; i++)
  15.     {
  16.         cin >> pierwsza[i];
  17.     }
  18.     for(int i = 0 ; i<liczba ; i++)
  19.     {
  20.         if (pierwsza[i]==1)
  21.         {
  22.             cout <<"TAK" <<endl;
  23.         }
  24.         else
  25.         {
  26.             dzielnik=0;
  27.             for (int a = 1; a<100000; a++)
  28.             {
  29.                 if (pierwsza[i]%a==0)
  30.                 {
  31.                     dzielnik++;
  32.                 }
  33.             }
  34.             if(dzielnik==2)
  35.                 cout << "TAK"<<endl;
  36.             else
  37.                 cout << "NIE"<<endl;
  38.         }
  39.     }
  40.  
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement