Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include <math.h>
- using namespace std;
- double returnA(double a, double b, double c){
- double x1, x2, A2;
- double D = b*b - 4*a*c;
- if(a==0){
- cout<< "\"a\" ne moje da e 0!"<< endl;
- }else if(D<0){
- cout << "Nyama reshenie!";
- }else{
- x1 = (-b + sqrt(b * b - 4 * a * c)) / (2 *a);
- x2 = (-b - sqrt(b * b - 4 * a * c)) / (2 * a);
- A2 = x1 + 2*x2;
- cout << "A=" << A2;
- }
- }
- int main(){
- double a, b, c;
- cout << "a= ";
- cin >> a;
- cout << "b= ";
- cin >> b;
- cout << "c= ";
- cin >> c;
- returnA(a, b, c);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement