How can i do scanf's in just one line? because example first i will input a number then i will press enter then the cursor will go to the next line. how can i maintain the cursor in just one line? thank you
Type everything on one line, then press enter. scanf() is natrually designed to handle this kind of input unless you go out of your way to ensure that each number is on a separate line.
But even then, after you hit enter the cursor will move to the next line. This isn't something you can portably control from C because it's an effect of the command line. It's possible, but you'll need to jump into non-portable libraries. Since this is encroaching on territory best suited to GUIs, you might consider dropping the command line entirely and writing a graphical interface.
It's not about the calls to scanf(), the requirement for one to press enter is at a lower level than your program. You could have multiple calls to scanf() in a loop and still put everything on one line. Conversely, you could have a single call looking for multiple items and still press enter between each item. This is because scanf() will block until a matching failure or until it reads everything requested; there's nothing magic about a newline.