All pastes #2913 Raw Edit

quadratic code

public c v1 · immutable
#2913 ·published 2004-12-12 16:09 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();}