mirror of https://github.com/TheAlgorithms/C
dont print 0 coeffs
This commit is contained in:
parent
d3d7cce24d
commit
da073120d0
|
@ -98,9 +98,9 @@ int main(int argc, char **argv)
|
||||||
for (n = 0; n < degree; n++)
|
for (n = 0; n < degree; n++)
|
||||||
{
|
{
|
||||||
coeffs[n] = strtod(argv[n + 1], NULL);
|
coeffs[n] = strtod(argv[n + 1], NULL);
|
||||||
if (n < degree - 1)
|
if (n < degree - 1 && coeffs[n] != 0)
|
||||||
printf("(%g) x^%d + ", coeffs[n], degree - n - 1);
|
printf("(%g) x^%d + ", coeffs[n], degree - n - 1);
|
||||||
else
|
else if (coeffs[n] != 0)
|
||||||
printf("(%g) x^%d = 0\n", coeffs[n], degree - n - 1);
|
printf("(%g) x^%d = 0\n", coeffs[n], degree - n - 1);
|
||||||
|
|
||||||
/* initialize root approximations with random values */
|
/* initialize root approximations with random values */
|
||||||
|
|
Loading…
Reference in New Issue