GoConqr has a new look! Let us know what you think.

Notes

Untitled

andre jean-bapti Computer Science 4 English 1 page

Content of the notes (1)

Page 1

// Write a C++ program to compute the real roots of the equation: ax2+bx+c=0.

#include

#include

using namespace std;

int main()

{

double a, b, c, x, last;

cout<<"Input 3 Values \n";

cin>>a>>b>>c; //a=2, b=5, c=3

if(a == 0 && b == 0) {

cout<<"no solution"< else if(a == 0) {

cout<<"one root: "<<-b/c< else {

last = b*b-4*a*c;

if(last < 0) {

cout<<"No roots \n"; }

else { cout<<"Roots: "<<-b+sqrt(b*b-4*a*c)/(2*a)<<

",x1= "<<-b-sqrt(b*b-4*a*c)/(2*a); }

}

system("pause");

return 0;

}

Information

Description
4 Computer Science Note on Untitled, created by andre jean-bapti on 08/06/2016.
Created by
andre jean-bapti · Jun 2016
Updated
Jun 9, 2016
Views
0
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?