#include<stdio.h> #include<conio.h> #include<math.h> void again(char choice); void main() { int a,b,c, ctr; float d,r1,r2, f1, f2, x, y, z, m, n, mn, ff1, ff2, add_my_nx; char choice; clrscr(); textcolor(YELLOW); gotoxy(15, 7);printf("ENTER THE VALUE OF A,B,C TO FORM THE QUADRATIC EQUATION"); gotoxy(38, 9);printf("ax%c%cbx%cc ", 253, 241, 241); gotoxy(5, 11);printf("a="); scanf("%d",&a); gotoxy(40, 11);printf("b="); scanf("%d",&B)/>; gotoxy(65, 11);printf("c="); scanf("%d",&c); gotoxy(33, 13);printf("The equation is: "); gotoxy(38, 14); if(a !=1){ gotoxy(36, 14); if(b>0 && c>0) printf("%dx%c+%dx+%d", a, 253, b, c); else if(b>0 && c<0) printf("%dx%c+%dx%d", a, 253, b, c); else if(b<0 && c>0) printf("%dx%c%dx+%d", a, 253, b, c); else if(b<0 && c<0) printf("%dx%c%dx%d", a, 253, b, c); gotoxy(35, 16);} if(a==1) if(b>0 && c>0) printf("x%c+%dx+%d", 253, b, c); else if(b>0 && c<0) printf("x%c+%dx%d", 253, b, c); else if(b<0 && c>0) printf("x%c%dx+%d", 253, b, c); else if(b<0 && c<0) printf("x%c%dx%d", 253, b, c); gotoxy(35, 16); if(a<=0) printf("The Equation is unfactorable..."); else if(a==1) { d=(b*B)/>-4*a*c; r1=((-B)/>+sqrt(d))/(2*a); r2=((-B)/>-sqrt(d))/(2*a); gotoxy(30, 15);printf("Factoring the Equation.");delay(9999999); gotoxy(53, 15);printf(".");delay(9999999); gotoxy(54, 15);printf(".\a");delay(9999999); gotoxy(35, 16); if(sqrt(d)<0) printf("NO REAL ROOT EXISTS:"); else if(r1<0 && r2<0) { printf("(x+%.0f)(x+%.0f)",fabs(r1), fabs(r2)); } else if(r1<0 && r2>0) { printf("(x+.0f)(x&.0f)", r1, fabs(r2)); } else if(r1>0 && r2<0) { printf("(x-%.0f)(x+%.0f)", r1, fabs(r2)); } else if(r1>0 && r2>0) { printf("(x-%.0f)(x-%.0f)", r1, r2); } } else if (a>1) {ctr=0; for(m=-500; m<500;) {/*m*/ n=-500; for(n=-500; n<500; m*n !=a) {/*n*/ mn = m*n; if(mn != a) n++; else if (mn == a) {/*if*/ x=-500; for(x=-500; x<500;) {/*x*/ y=-500; for(y=-500; y<500;) {/*y*/ z= x*y; add_my_nx= (m*y)+(n*x); if(ctr==3) {break;} if(z != c) y++; else if(z == c && add_my_nx==B)/> { if(m<0) ff1=fabs(m); else if(m>0) ff1=-m; if(n<0) ff2=fabs(n); else if(n>0) ff2=-n; if(x<0) f1=fabs(x); else if(x>0) f1=-x; if(y<0) f2=fabs(y); else if(y>0) f2=-y; ctr++; } else y++; }/*end y*/ if(z !=B)/> x++; }/*end x*/ }/*end if*/ if(mn == a && z!=B)/> n++; }/*end n*/ m++; }/*end m*/ gotoxy(30, 15);printf("Factoring the Equation.");delay(999999999); gotoxy(53, 15);printf(".");delay(999999999); gotoxy(54, 15);printf(".\a");delay(999999999); gotoxy(35, 16); if(ff2==1) if(f1>0 && f2>0) printf("(%.0fx+%.0f) (x+%.0f)", ff1, f1 , f2); else if(f1>0 && f2<0) printf("(%.0fx+%.0f)(x%.0f)", ff1, f1, f2); else if(f1<0 && f2>0) printf("(%.0fx%.0f)(x+%.0f)", ff1, f1, f2); else if(f1<0 && f2>0) printf("(%.0fx%.0f)(x%.0f)", ff1, f1, f2); if(ff2 !=1) if(f1>0 && f2>0) printf("(%.0fx+%.0f) (%.0fx+%.0f)", ff1, f1 ,ff2, f2); else if(f1>0 && f2<0) printf("(%.0fx+%.0f)(%.0fx%.0f)", ff1, f1, ff2, f2); else if(f1<0 && f2>0) printf("(%.0fx%.0f)(%.0fx+%.0f)", ff1, f1, ff2, f2); else if(f1<0 && f2>0) printf("(%.0fx%.0f)(%.0fx%.0f)", ff1, f1, ff2, f2); } again(choice); } void again(char choice) { gotoxy(20, 18);printf("Would you like to enter another equation?"); gotoxy(39, 19);printf("Y/N"); gotoxy(40, 20);scanf("%s", &choice); if(choice== 'y') main(); else if(choice == 'n') {clrscr(); gotoxy(30, 12);printf("THANK YOU! GOODBYE!"); delay(99999999); exit();} else if(choice != 'y' || choice != 'n') {gotoxy(30, 21);printf("Enter a valid option..."); again(choice);} }

first of all: i'm kinda new in the forums and YES I KNOW HOW STUPID IT(the "code") LOOKS!

I didnt really care for readable code back then. I just wanted the thing to run correctly. I dont do that anymore(not as much xD) just so everyone knows! i did this in Turbo C 2.01 (they still teach it at school for 1st years. yes i know right?). what makes me laugh is the part with the super long indentions and the comments that i used so the curly braces will be less confusing. yea try to look at the code and get some lulz xD