Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- int a, b, c, delta;
- double x,y;
- cout << "inserisci il primo termine x^2: ";
- cin >> a;
- cout << "inserisci il secondo termine x: ";
- cin >> b;
- cout << "inserisci il terzo termine noto: ";
- cin >> c;
- delta = b^2 * (4*a*c);
- cout << "il delta e' :"<< delta;
- if (delta==0){
- x= (-(b)-(sqrt (delta))) /(2*a);
- y= (-(b)+ (sqrt (delta))) /(2*a);
- cout << "\nLe soluzioni sono coincidenti: x1= " << x << " e x2= " << y;
- } else if (delta >0) {
- x = (-(b)-(sqrt (delta))) /(2*a);
- y = (-(b)+(sqrt (delta))) /(2*a);
- cout << "\nLe soluzioni sono: x1= " << x << " e x2 = " << y;
- }else if (delta <0) {
- cout << "\nNon esistono soluzioni";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement