fork download
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4.  
  5. int testy;
  6.  
  7. int szukanie(int i)
  8. {
  9.  
  10. for(int n=2;n*n<=i;n++)
  11. if(i%n==0)2
  12.  
  13.  
  14. return false;
  15. }
  16.  
  17.  
  18. int main()
  19. {
  20.  
  21. cin>>testy;
  22.  
  23. int liczby[testy];
  24.  
  25. for(int i = 0;i<=testy-1;i++)
  26. {
  27. cin>>liczby[i];
  28. }
  29.  
  30. for(int i = 0;i<=testy-1;i++)
  31. {
  32. int i = liczby[i];
  33.  
  34. if (liczby[i]%liczby[i] == 0 && szukanie(i)!= false && liczby[i]!= 1)
  35. cout<<"Tak"<<endl;
  36. else if(liczby[i] ==2)
  37. cout<<"Tak"<<endl;
  38. else
  39. cout<<"Nie"<<endl;
  40. }
  41.  
  42.  
  43.  
  44. return 0;
  45. }
  46.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int szukanie(int)’:
prog.cpp:11:20: error: expected ‘;’ before ‘return’
         if(i%n==0)2
                    ^
                    ;
prog.cpp:14:5:
     return false;
     ~~~~~~          
prog.cpp:15:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
prog.cpp: In function ‘int main()’:
prog.cpp:32:13: error: redeclaration of ‘int i’
         int i = liczby[i];
             ^
prog.cpp:30:13: note: ‘int i’ previously declared here
     for(int i = 0;i<=testy-1;i++)
             ^
stdout
Standard output is empty