#include <stdio.h>
void print_quadratic(int a, int b, int c)
{
printf("%dx^2 ", a);
if (b >= 0) {
printf("+ %dx ", b);
} else {
printf("- %dx ", -b);
}
if (c >= 0) {
printf("+ %d", c);
} else {
printf("- %d", -c);
}
printf("\n");
}
int main()
{
int a, b, c;
printf("Enter a: \n");
scanf("%d", &a);
printf("Enter b: \n");
scanf("%d", &b);
printf("Enter c: \n");
scanf("%d", &c);
print_quadratic(a, b, c);
return 0;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter