diff --git a/3xplus1.c b/3xplus1.c index ff58fe1..0ca82ce 100644 --- a/3xplus1.c +++ b/3xplus1.c @@ -9,7 +9,7 @@ int main( int argc, char *argv[] ) { //yoinked from the internet argc is number return 0; //idk if this is how i should return an error idk @quantum rip my code to shreads } - x = atoi(argv[1]); + x = atoi(argv[1]); //mmmm yes the atoi is made out of atoi if(x == 0){ puts("uhhhh you entered 0 this wont end"); @@ -21,7 +21,7 @@ int main( int argc, char *argv[] ) { //yoinked from the internet argc is number while(x != 1){ //while x is not true i think - printf("%d\n",x ); + printf("%d\n",x ); //shit like this was difficualt in asm because i had to preserve all my registers if(x & 1 == 1){ //if x is odd x = (3 * x) + 1; } diff --git a/a.out b/a.out index f9681a7..46dc467 100755 Binary files a/a.out and b/a.out differ diff --git a/quadratic.c b/quadratic.c new file mode 100644 index 0000000..f3c5c1e --- /dev/null +++ b/quadratic.c @@ -0,0 +1,40 @@ +#include //printf and shit +#include //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; +}