Ok, so I revamped my code a little bit:

Code:

#include <stdio.h>
#include <math.h>
double function(double x);
int main()
{
double x;
printf("Enter a number x: ");
scanf("%lf\n", &x);
if (x != 0 || x > -2) {
printf("f(x) = %lf\n", function(x));
}
else {
printf("f(x) is not defined\n");
}
return(0);
}
double function(double x)
{
return (((1+(x*x)/sqrt(3*x+6))/(x*x-5*x)));
}

So here's my problem now: It will ask me to enter a value of x, and I do. but I have to enter another number after it in order for the program to give me output. This is what it looks like:

Code:

Enter a number x: 2.74 //This doesn't do anything
2.74 //This is the number that gets the program to give output
f(x) = -0.482997

What am I doing wrong?