fork(1) download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. int main(void) {
  6.  
  7. int num;
  8.  
  9. srand((unsigned)time(NULL));
  10. num = rand()%10+1;
  11. switch(num){
  12. case 1:
  13. case 2:
  14. printf("グー");
  15. break;
  16. case 3:
  17. case 4:
  18. case 5:
  19. printf("チョキ");
  20. break;
  21. default:
  22. printf("パー");
  23. break;
  24. }
  25.  
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
グー