fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int n,z,s=0;
  5. scanf("%d",&n);
  6. for(z=n-1;z>1;z--){
  7. n=n%z;
  8. if(n!=0){
  9. s=1;
  10. }
  11. }
  12. if(s==0){
  13. printf("素数出ない");
  14. }
  15. if(s==1){
  16. printf("素数");
  17. }
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 5292KB
stdin
9
stdout
素数