this is the code i have written so far (BTW GetInteger is a short cut to just get an int straight from code)
Code:
#include <stdio.h>
#include "math.h"
int main() {
double a, b, c, ansr1, ansr2, bottomofquad;
int inta, intb, intc;
printf("Enter A: ");
inta = GetInteger();
printf("Enter B: ");
intb = GetInteger();
printf("Enter B: ");
intc = GetInteger();
a = (double)inta;
b = (double)intb;
c = (double)intc;
bottomofquad = 2.0 * a;
double root = b * b + 4.0*a*c;
root = sqrt(root);
ansr1 = -b + root;
ansr2 = -b - root;
ansr1 = ansr1/bottomofquad;
ansr2 = ansr2/bottomofquad;
printf("The answers are %g and %g",ansr1, ansr2);
i tested it with 3,5,2and the out put should be -0.666666666666 and -1
but the program gives me:
0.333333333333 and -2
i cannot find what is the problem any help would be greatly appreciated
cheers