zombie
33218f0960
what a suprise @quantum thooooommmmmaaasss it dont work plez help it gives wrong answer
40 lines
1.2 KiB
C
40 lines
1.2 KiB
C
#include <stdio.h> //printf and shit
|
|
#include <math.h> //website told me to use fabs for floating point absolute value
|
|
|
|
int main( int argc, char *argv[] ) { //yoinked from the internet argc is number of args and argv is a "array of arguments"
|
|
|
|
int a, b, c; //uhhhhhh how to ascii to float
|
|
|
|
float x, deter, plusans, minusans;
|
|
|
|
|
|
const float pi = 3.1415926535897932384626338f;
|
|
|
|
printf("%f\n", pi); //did i print pi corectly???
|
|
|
|
if(argc != 4){
|
|
puts("please provide a b c");
|
|
return 0; //idk if this is how i should return an error idk @quantum rip my code to shreads
|
|
}
|
|
|
|
a = atoi(argv[1]); //mmmm yes the atoi is made out of atoi
|
|
b = atoi(argv[2]); //mmmm yes the atoi is made out of atoi
|
|
c = atoi(argv[3]); //mmmm yes the atoi is made out of atoi
|
|
|
|
printf("Got: %dx²+%dx+%d\n", a, b, c); //wow this looks like ass
|
|
|
|
deter = (b^2)-(4*a*c);
|
|
//deter = 12f;
|
|
printf("Deter = %f\n", deter);
|
|
if(deter < 0){
|
|
puts("deter is negitve this will result in a imaginary number");
|
|
return 0;
|
|
}
|
|
|
|
plusans = (-b + sqrt(deter))/(2*a); //pemdas is cringe
|
|
printf("Plusans = %f\n", plusans);
|
|
minusans = (-b - sqrt(deter))/(2*a); //pemdas is cringe
|
|
printf("Minusans = %f\n", minusans);
|
|
|
|
return 0;
|
|
}
|