View Code of Problem 42

#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;

int main() {
	double a, b, c;
	scanf_s("%lf%lf%lf", &a, &b, &c);
	double x,y1,y2;
	x = sqrt(b*b - 4*a*c);
	y1 = (-b + x) / (2 * a);
	y2 = (-b - x) / (2 * a);
	printf("%.2lf,%.2lf", y1, y2);
	return 0;
}

/*
Main.cc: In function 'int main()':
Main.cc:8:33: error: 'scanf_s' was not declared in this scope
  scanf_s("%lf%lf%lf", &a, &b, &c);
                                 ^
*/

Double click to view unformatted code.


Back to problem 42