#include <stdio.h>
#include <math.h>
int risolvi(double a, double b, double c, double *x1, double *x2) {
double d = b * b - 4 * a * c;
if (d < 0) return 0;
*x1 = (-b + sqrt(d)) / (2 * a);
*x2 = (-b - sqrt(d)) / (2 * a);
return d > 0 ? 2 : 1;
}
int main() {
double a, b, c, r1, r2;
printf("Inserisci a, b, c: ");
if (scanf("%lf %lf %lf", &a, &b, &c) == 3) {
int n = risolvi(a, b, c, &r1, &r2);
printf(n == 2 ? "Due sol: %.2f e %.2f\n" : (n == 1 ? "Una sol: %.2f\n" : "No sol.\n"), r1, r2);
}
return 0;
To embed this project on your website, copy the following code and paste it into your website's HTML: