How's your code looking?

How's your code looking?

Other urls found in this thread:

en.wikipedia.org/wiki/Sieve_of_Eratosthenes
i.imgur.com/uF2lPiV.png
i.imgur.com/Qvx7YTG.png
i.imgur.com/XRKzX4E.png
i.imgur.com/DRRw998.png
i.imgur.com/tzTkMD8.png
i.imgur.com/nEq1NrA.png
i.imgur.com/sKpRMiY.png
i.imgur.com/CD9iqKz.png
i.imgur.com/YUDNzbG.png
twitter.com/SFWRedditGifs

My compiler keeps exploding.

the classic

kek

damn didn't realize 102 was odd

I... what

Jesus is that shit for real ?

I've tried this before, and my compiler doesn't go any higher than primes > 100k.

I think it was just the IDE I was programming in, though.

(the way I did it is by first making a program that does sysoutprint("input == "+prime[i]+" || "); or something similar)

Christ, these never fail to crack me up. My girlfriend just kicked off after I started laughing in bed as she said I'll wake her son.

...

...

I don't understand how this works

why would you iterate each value one by one?

It compares the argument with every even number from 2 to 2147483646

[spoiler]I've seen this in production[/spoiler]

I'm watching from right behind you and I still don't understand what's going on.

Seems fine to me, but I would change it so it says:
function toHex(nibble){
if(nibble=10){
return nibble==10 ? "A" :
nibble==11 ? "B" :
nibble==12 ? "C" :
nibble==13 ? "D" :
nibble==14 ? "E" : "F" ;
}
}

No. They don't teach programming in girls who code. They spend 8 weeks on teambuilding and confidence building exercies before letting them loose in scratch for a couple of hours.

>tfw correcting shit like this and adding sick bantz to the commit message

I bet Indians code like this

I mean yeah it works fine but it could also just be replaced with:
function toHex(nibble) {
return nibble.toString(16).toUpperCase();
}

and maybe even a check to return null of the nibble is < 0 or nibble > 15, in case that is the expected behavior

Oh, alright. I'm not familiar with javascript, so I wasn't familiar with toString(n);

>Raising someone else's kid
Cuck

Kek'd hard. Jesus... these retards get let loose on live code we are completely and utterly fucked.

>Le quirky random number XD

>Not doing a for loop

product = 0
for (i = 0; i = b; i++) {
float product += a
}

Girls need to be gassed

>random
retard

wow, you must have coded for decades

I'm not a mathsfag. How exactly WOULD you find if a number is prime without looping through odd integers and checking for factors? It seems this method would actually be faster since it cuts the bullshit and only checks for primes as a factor. A database of some sort would make it look cleaner, but it's the same process essentially..

For the record, I'm only a sophomore in computer science.

Here's one way that is pretty efficient.
en.wikipedia.org/wiki/Sieve_of_Eratosthenes

Change your major.

kill yourself nerd

pretty easy fix to be honest

>THE NUMBER IS FALSE

I mean, I don't plan to get into cryptography or security in general, so I don't see how that applies to me.

Either way, I don't see how that method would reduce the required cpu cycles? You're still looping through from 3 to root(number) and checking.

kek i didnt even notice that

It's checking the numbers co-primes to 2*3*5*7*11*13, not the prime numbers.

can someone post that really long image of the guy talking about windows codebase on IRC?

wouldn't this be easier?

This has like four syntax errors in Java, or three syntax errors and an infinite loop in C++.

>what is an algorithm

cant you just divide the number they enter by 2, and if its whole number then its even? I usually don't code stuff using numbers like this, but seems far easier than using OR operator.

He's... actually proud of himself for writing that?

i think so, he gassed himself smelling his own farts so bad he damaged his brain

What's the time complexity?

Literally read the article.

That's the whole point. Congratulations on getting it.

I actually don't care for your sarcasm but still. cool, I guess.

>just divide the number they enter by 2,
>and if its whole number then its even

>casting to floats

pleb here.

Isn't more code required to check if the number is or is not whole? what would that look like?

>Isn't more code required to check if the number is or is not whole? what would that look like?

x/2-floor(x/2)==0
x/2*2==x
or just
x%2 == 0
x & 1 == 0

for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
for (int k = 0; k < 10; k++) {
for (int m = 0; m < 1000; m++) {
// do work
}
}
}
}


Still laughing that I wrote this

why do people do computer science over software engineering?

>tfw BE with work experience during college
>tfw 30k starting any job i want

jesus christ my sides
i hope to submit this in an assignment one day

Not if you're using integers

needs more % 60.

Can someone explain to me what the proper way to code this would be?

Convert.ToInt64(nibble 16)

Well, I wrote some Wordpress themes and never learned Javascript or PHP. So my improvisations must look awesome.

Someone has to do it.

Thats awful. What a rip off. I wish I could have learned to program with only girls. The computer labs on campus always smelled like cheetos and butthole. And dudes laughing about fucking ponys and memes

I know a lot of women who could program your asshole to code better than you

haven't started writing it yet :3

>product = 0
>for (i = 0; i = b; i++) {
>float product += a

public int product(int a, int b){
int product = 0;
for(int i = 0; i < b; i++){
product += a;
}
return product;
}


>declaring an already delcared variable in a loop
>i (int) < b (float) casts will fuck up all your code
>i is not declared
>fuck the semicolons

gas yourself

please tell this is bait

Wait, what meme is this? "why i graduate" meme?
"cs not even once" meme?

How new are you?

public static void main(String[] args)
{
Scanner scanner = new Scanner(System.in);
System.out.println("Enter a number: ");
int num = scanner.nextInt();

if(num == 0)System.out.println("Number is even.");
else if(num ==1)System.out.println("Number is odd.");
else if(num == 2)System.out.println("Number is even.");
else if(num ==3)System.out.println("Number is odd.");
else if(num == 4)System.out.println("Number is even.");
else if(num ==5)System.out.println("Number is odd.");
else if(num == 6)System.out.println("Number is even.");
else if(num ==7)System.out.println("Number is odd.");
else if(num == 8)System.out.println("Number is even.");
else if(num ==9)System.out.println("Number is odd.");
}

r8 my code

>name
explain

>Java
Immediate 0/10.

>csgrad.jpg

the exclamation marks are on point

I'm doing a terrible thing

func main () {
http.HandleFunc("/", mainHandler)
http.HandleFunc("/futaba.php", postHandler)
http.HandleFunc("yolo.php", makeHandler(tagHandler))
http.ListenAndServe(":8080", nil)

}

>golang
>.php in routes
Why?

cegrad.jpg if you don't mind

And they're old memes to boot. Talking about chuck Norris and shit

>Le quirky LONG_MAX/2^31-1

sometimes you dont trade cpu cycles for a shitload of memory use, its not like you are programming Firefox or anything, right ?

You need to understand that your cpu is idle 99% of the time, 990ms idle in a second, you can for sure waste some cycles.

wtf?

You guys see yandere simulator code

i.imgur.com/uF2lPiV.png
i.imgur.com/Qvx7YTG.png
i.imgur.com/XRKzX4E.png
i.imgur.com/DRRw998.png
i.imgur.com/tzTkMD8.png
i.imgur.com/nEq1NrA.png
i.imgur.com/sKpRMiY.png
i.imgur.com/CD9iqKz.png
i.imgur.com/YUDNzbG.png

i have opened couple of those pics and everything looks okay to me.

we know its you yandev

using the facilities provided by your language's standard library

I would deny that on a PR for reinventing the wheel alone

if this isn't bait
var prod = () => Array.prototype.slice.call(arguments).reduce((a,b) => a+b)

I'm minoring in CS right now, the smelly classroom is not a meme, it's real.
Lots of legit autism too, which can be either interesting (while solving a problem) or a disaster (while discussing literally anything but CS)

Im pretty sure that's how much that variable can hold

That thrown exception to exemplify laziness

This better be bait

I'm trying to remember some bullshit workarounds I've done in the past, but I got nothing.

Guess I haven't coded in a few months :^)

lmao what a retard

You could replace the checking for each letter with an addition:

char to_hex(unsigned int nibble)
{
if (nibble < 10) {
return '0' + nibble;
} else {
return 'A' + (nibble - 10);
}
}

I wonder that as computers have more and more memory, some programs could be optimised by including tables of their most common equations.

I feel kinda sad because I love programming and I would be perfectly capable of teaching code up to a university level and have them enjoy it.

Unfortunately the private game makes so much more money.

>1,2,3,4,5,6,7,8,9,A1,A2,A3,A4,A5

Hex goes 1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,10,11...18,19,A0,A1...A8,A9,B0

...

Do yourself a favor and use a better editor. Not even insulting you, Notepad++ is just garbage compared to other editors