Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  eq.grado.2
Language: C/C++
Code:
#include <stdio.h> 
#include <math.h> 
main()
{
float a, b, c, D, x1, x2;
printf("Soluzione di un'equazione di 2o grado\\n");
printf("inserire in ordine i tre coefficienti\\n");
scanf("%e,%e,%e", &a, &b, &c);
if (a==0 && b==0 && c==0)
{
 printf("equazione indeterminata\\n");
 printf("bATTI UN TASTO PER FINIRE");
 scanf("%e", &a);
}
else
 D=b*b-4*c*a;
 if (D>=0)
{
  x1=(-b+sqrt(D))/(2*a);
  x2=(-b-sqrt(D))/(2*a);
  printf("il valore di x1 è ",x1,"\\n");
  printf("il valore di x2 è ",x2,"\\n");
}
 else
  printf("equazione impossibile\\n");
return 0;
}

          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
Comments: