i have created a loop for displaying the first 99 natural numbers and have also used delay(1000); between each output.
However i want that if the user enters spacebar during the execution of the loop , then the loop must break.
so the problem is that how can i ask for a value from the user while continuing the execution ??
Basically, you can't. I mean, you can't both wait and not-wait.
If you are using an operating system you could crete two tasks: One that does the output of numbers and then does a 1000-ms timed-wait for a semaphore. This semaphore is then given by an input task if a space character is input. By checking the return value of the semaphore wait-operation you could determine if you got out of the wait due to timeout or a space.