Code:
if(b == 0 && c != 0)
{
printf("There are no roots as the equation has no x components (x may take any real value).\n");
}
else if(c == 0 && b != 0)
{
printf("There is 1 root.\n Root1 = 0.\n");
}
else if(b == 0 && c ==0)
{
printf("There are no roots as you have no equation! (x may take any real value)\n");
}
else
{
Root1 = (-c)/b;
printf("There is 1 root.\n Root1 = %lg.\n", Root1);
}
In this section for starters.
To something like this:
Code:
if(b == 0)
{
if(c == 0)
{
printf("There are no roots as you have no equation! (x may take any real value)\n");
}
else
{
Root1 = (-c)/b;
printf("There is 1 root.\n Root1 = %lg.\n", Root1);
}
}
else
{
if(c == 0)
{
printf("There are no roots as you have no equation! (x may take any real value)\n");
}
else
{
printf("There are no roots as the equation has no x components (x may take any real value).\n");
}
}
Please note: This logic might not be exactly what you want but shows my meaning.
Jim