All pastes #7540 Raw Edit

Stuff

public java v1 · immutable
#7540 ·published 2005-03-16 09:45 UTC
rendered paste body
#include <conio.h>#include <stdio.h>#include <math.h>int main() {	int a,b,c,d;	printf(" ----------Quadratic Solver----------\n\n");	printf("Enter the variables, separated by spaces: ");	scanf("%d %d %d",&a,&b,&c);	d = pow(b,2) - 4 * a * c;	if (d < 0) {		printf("This formula cannot be solved.");	}	elseif (d == 0) {		float total;		total = -b / (2 * a);		printf("Solution:\n    %d",total);	}	elseif (d > 0) {		float root,total1,total2;		root = sqrt(d);		total1 = (-b + root) / (2 * a);		total2 = (-b - root) / (2 * a);		printf("Solutions:\n    %d\n    %d",total1,total2);	}	return 0;	getch();}