fork download
  1. #include<stdio.h>/*a6x3i9*/
  2. #include<time.h>
  3.  
  4. int main(void){
  5. int a[5][5];
  6.  
  7. int num;
  8. int max=99;
  9. int total=10;
  10. srand((unsigned)time(NULL));
  11. for(int i=0;i<=4;i++){
  12. for(int j=0;j<=4;j++){
  13. a[i][j]=rand() % 99+1;
  14. }
  15. }
  16.  
  17. for(int i=0;i<=4;i++){
  18. for(int j=0;j<=4;j++){
  19. printf(" %2d",a[i][j]);
  20. }
  21. printf("\n");
  22. }
  23.  
  24. for(int k=0; k<total; k++){
  25. num=rand() % max+1;
  26. printf("%2d/%d回目の数:",k+1,total);
  27. printf(" %d\n",num);
  28.  
  29. for(int i=0; i<=4; i++){
  30. for(int j=0; j<=4; j++){
  31. if(a[i][j]==num)
  32. a[i][j]=0;
  33. }
  34. }
  35.  
  36. for(int i=0; i<=4; i++){
  37. for(int j=0; j<=4; j++){
  38. if(a[i][j]==0){
  39. printf("**");
  40. }else{
  41. printf(" %2d",a[i][j]);
  42. }
  43. }
  44. printf("\n");
  45. }
  46.  
  47. }
  48.  
  49. return 0;
  50.  
  51. }
  52.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
 75  8 91 19 41
 17  2 97 79 16
 62 55 11 79 78
 62 57 54 73 50
 46  8 42 90 96
 1/10回目の数: 16
 75  8 91 19 41
 17  2 97 79**
 62 55 11 79 78
 62 57 54 73 50
 46  8 42 90 96
 2/10回目の数: 56
 75  8 91 19 41
 17  2 97 79**
 62 55 11 79 78
 62 57 54 73 50
 46  8 42 90 96
 3/10回目の数: 81
 75  8 91 19 41
 17  2 97 79**
 62 55 11 79 78
 62 57 54 73 50
 46  8 42 90 96
 4/10回目の数: 23
 75  8 91 19 41
 17  2 97 79**
 62 55 11 79 78
 62 57 54 73 50
 46  8 42 90 96
 5/10回目の数: 3
 75  8 91 19 41
 17  2 97 79**
 62 55 11 79 78
 62 57 54 73 50
 46  8 42 90 96
 6/10回目の数: 46
 75  8 91 19 41
 17  2 97 79**
 62 55 11 79 78
 62 57 54 73 50
**  8 42 90 96
 7/10回目の数: 95
 75  8 91 19 41
 17  2 97 79**
 62 55 11 79 78
 62 57 54 73 50
**  8 42 90 96
 8/10回目の数: 11
 75  8 91 19 41
 17  2 97 79**
 62 55** 79 78
 62 57 54 73 50
**  8 42 90 96
 9/10回目の数: 35
 75  8 91 19 41
 17  2 97 79**
 62 55** 79 78
 62 57 54 73 50
**  8 42 90 96
10/10回目の数: 14
 75  8 91 19 41
 17  2 97 79**
 62 55** 79 78
 62 57 54 73 50
**  8 42 90 96