One note that I haven’t seen in the comments yet is scanf returns an int that indicates the result of the parsing. Since this operation could fail from bad user input you should be checking this value
Edit: Link to scanf documentation: https://man7.org/linux/man-pages/man3/scanf.3.html


And most of them are children!