libraries – How to run C program with math.h from command line (and Sublime Text)

I am trying to run a C program containing the math.h header.
I used Sublime Text to write the code and it can’t build the program because it doesn’t know where to find the math library. The problem is that I don’t know either!

Here I read that I can run the program from the command line by specifying the path to library:

gcc -o myprog myprog.c -L/path/to/libs -lm

But how can I find out where’s the math library?

If I try to run the program without specifying the path:

gcc -o myprog myprog.c -lm

Then the terminal waits for me with the $ to say something else, so I say:

./myprog.c

And after that, again, it waits with the $ for a new prompt. But this this time whenever I press enter I just continue to write on a new line, so I can’t execute commands anymore.

I am new to command line, Ubuntu and compilers, how can I run the program?

Bonus question: if I didn’t have math.h I could run the program directly inside Sublime. How can I run this program inside Sublime?