fork download
  1.  
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. bool eh_primo(int x){
  7. if(x==1){
  8. return false;
  9. }
  10. if(x==2){
  11. return true;
  12. } else{
  13. for(int i=2; i<x; i++){
  14. if(x%i==0){
  15. return false;
  16. break;
  17. }
  18. if(i==x-1){
  19. return true;
  20. }
  21. }
  22. }
  23. }
  24.  
  25. int main(){
  26. int x;
  27.  
  28. cin>>x;
  29.  
  30. if(eh_primo(x)){
  31. cout<<"S"<<"\n";
  32. }else{
  33. cout<<"N"<<"\n";
  34. }
  35. return 0;
  36. }
Success #stdin #stdout 0s 15240KB
stdin
8831
stdout
S