Why functions exist
Not to look tidy. Two real reasons.
First, a function lets you name an idea. is_prime(n) says what it does. Fourteen lines of loop in the middle of main does not.
Second, a function is tested once and trusted everywhere. If your factorial is right, every call is right. Copy-pasted code has to be fixed in every copy, and you will miss one.
Declaration, definition, call
#include <stdio.h>
int add(int a, int b); /* declaration (prototype) */
int main(void)
{
int sum = add(3, 4); /* call */
printf("%d\n", sum); /* 7 */
return 0;
}
int add(int a, int b) /* definition */
{
return a + b;
}