diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 51551e1..74e1c47 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -485,6 +485,25 @@ void inputFunction(int grid[SIZE][SIZE]) { } else { printf("Invalid input. Please enter a number between 1 and 9.\n"); } + } + printf("Enter the value to insert (1-9):\n"); + + + + + while (true){ + char nume_str[10]; + scanf("%s", nume_str); + + num = nume_str[0] - '0'; // Convert the first character to an integer + + if ((num >= 1 && num <= 9) && nume_str[1] == '\0') { + grid[row_e - 1][col_e - 1] = num; + printf("Value inserted successfully.\n"); + break; + } else { + printf("Invalid input. Please enter a number between 1 and 9.\n"); + } } break;