Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- float licz();
- int main()
- {
- licz();
- }
- float licz()
- {
- float a,b,c;
- cout << "Podaj a" <<endl;
- cin >> a;
- cout << "Podaj b" <<endl;
- cin >> b;
- cout << "Podaj c" <<endl;
- cin >> c;
- float delta= (b*b - (4*a)*c);
- if (delta>0)
- {
- float x1= ((-b)-sqrt(delta))/(2*a);
- float x2= ((-b)+sqrt(delta))/(2*a);
- cout << " X1 ="<< x1 <<endl<< "X2 = " << x2 <<endl;
- }
- else if(delta=0)
- {
- float x= ((-b)-sqrt(delta))/(2*a);
- cout << " X ="<< x <<endl;
- }
- else if(delta<0)
- {
- cout << "Nie ma rozwiazań."<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement