If you can't solve this, you don't belong here.
If you can't solve this, you don't belong here
x is unused and optimized out. Now fuck off
1 + 0 + 5 + 10 = 16
you don't get to decide where I belong, fatso
Your kung fu no good.
x
11
This, you may be smarter than me OP but you are also fat and a virgin.
Nothing is returned
>love hearts in your code
gay
> var
ahahaha
Stop assuming the variable type your shitlord
No values are used. Everything is optimized away.
What is this garbage?
Write this shit in proper mathematical notation you fucking math illiterate code monkey, pic fucking related, so you can even get rid of that garbage loop.
6 - 22 - 81
6^3
What's the problem?
my head hurts
WHAT THE FUCJFKFJRJFI@
Bro, shouldn't the top part of sigma be n-1? The loop OP posted goes from 0 to 2 for n of 3.
n there is just the last number of the loop, not the total amount of iterations in it, since the loop never reaches i = 3, then n is 2.
But that's just how I defined it, you can redefine the function so that some g(3) = f(2), something like g(x) = g(x-1) + 5(x-1) with g(0) = 1, then x here is the amount of iterations and the sum, will go to n-1.
solve what?
>terrible formatting; for is not a function
>not defining i before the loop
>using x += ... instead of x = x + ...
>not using ++i
>wasting cpu for something that can be precalculated and used
how can a simple code can be coded so poorly
never change Jow Forums
>writing out calc II proofs in laytecks for a Mongolian fish trading forum
user, I...
>5 * 0
>He thinks multiplying by 0 is the same as dividing
For computer it is
wat
I'm a first year Software Engineering major and only earned the basics of Java. Please tell me with those things are bad practices.
Ah I see bro. Let's have a drink sometime while sharing our i3 configs and appreciate our ThinkPads.
>>using x += ... instead of x = x + ...
this is very good advice for languages that can not overload operators
>>not using ++i
fuck off
solve what? x will equal 16 if that's what you're asking.
>a simple code
>a code
Don't say it like that; you sound like a dumbass.
Anyway, what the fuck are those suggestions? They're all either micro-optimizations of an simple example or random interjections of your personal preferences on formatting.
>var i out of the loop
Depends on your needs, on C at least, if you define the variable in the loop, it gets pruned right after the loop is finished, so if you wanted to use the variable or the value of the variable for something else you're out of luck (ie you'd be redefining it again for no reason).
Another reason is that making a for loop parallel is a one line thing by just adding #pragma omp parllel for above the loop, but it requires the variable to be defined beforehand (also a very big reason to go for for loops whenever possible instead of while loops).
If you aren't going to do any of those, then it doesn't matter.
>using x += ... instead of x = x + ...
He's being retarded, if your language supports it... use it.
>++i
Modern compilers at least treat i++ and ++i the same, so unless you're actually using the pre and post increment/decrement capabilities of this notation, then it makes no difference.
What is this post lol
>for is not a function
So? OP didn't say it would run
>using x += ... instead of x = x + ...
Who cares?
>not using ++i
Why?
>wasting cpu for something that can be precalculated and used
Autism
>not defining i before the loop
Why the actual FUCK would you define i before the loop
>Another reason is that making a for loop parallel is a one line thing by just adding #pragma omp parllel for above the loop, but it requires the variable to be defined beforehand (also a very big reason to go for for loops whenever possible instead of while loops).
Actually, scratch that, what it doesn't allow is funny things like
int i = blah;
#pragma omp parallel for
for(i; ...)
it requires it to be
for(i = blah; ...) or for(int i = blah; ...)
>not defining i before the loop
which language is this??
>javascript
>optimized
>an simple example
>an simple
Don't say it like that; you sound like a dumbass.
>javascript
oof...
op is nothing and loves semicolon
I write software because it's not my job to solve the problem. My job is to come up with a way to abstract the problem in a way the computer understands and make it compute the solution.
My solution to your problem?
Execute it.
w..wait, what is it?
First of all, I love you
t. brainlet
Please be respectful towards your fellow human beings
It's undefined behaviour
t. chad
Into the "Union" folder it goes.
5 * 0 == 5 / (1/0) thus equals divided by zero also known as "undefined behavior". Prove me wrong you autistic fucks
1 += 5*0 = 1
1 += 5×1 = 6
1 += 5×2 = 11
1 += 5×3 = 16
derp
that's not what's happening at all you fucking troll
>derp
go back
Ok sure
>Mac+you=fag
Perfect
The amount of retardation in this thread...
no output
1 + 0 + 5 + 10 + 15
jfc
>solve
There's nothing to solve. That's a javascript program, not an equation.
Do you mean that if we can't EVALUATE this, we don't belong here? Because if so, you phrased it very poorly.
Shit it's < 3 so there's no 15,WHOOPS
>15
Spotted the math nerd lmao
thats the right way
>not using int
>using var
That is a shitty way of coding that leads to unsafe overflows and code breakage.
My dude.
In a good language, declaring a variable with a type does not constitute "assuming" the type, but rather coercing said type, either through reinterpretation, conversion, or compile-time checking.
x is not used anywhere and it'll get optimized away
What are you doing with that x variable after setting it to 31?
you use a mac and Javascript. You don't belong here.
If you cant solve this, you're a literal retard
>multiplying by zero is undefined behavior
WTF am I reading?
>i3 configs and appreciate our ThinkPads.
>that's exactly my setup
Well, damn.
>format c:\
Did I do good?
fpbp
pacman -Syu
>a new FizzBuzz is born
Okay, so you get it.
But now it's ++i.
Go.
your code returns nothing because you forgot to log the x you dumbass
Oh lord.
The thumbnail looks like it's ass of some stallion with giant balls.
js compilers / vms have a insane amount of potential for optimization; they're needed to counteract no-brain js devs
It's 31, right?
>Not knowing the difference between programming language
those look like balls
Use \cdot atleast to make it pretty
The answer is undefined. Because it's fucking javascript and you didn't return a value.
i failed my introduction to computing class 3 times about to take it for the fourth time this winter semester
based. makes me miss my math courses
third answer only right answer. OP here
"1051015"
Oh actually its "10510"
Multiplication is defined recursively in the natural numbers:
*: a * 0 = 0 and a * S(b) = a + (a * b)
a * 1 = a * S(0) = a + (a * 0) = a
a * 2 = a * S(1) = a + (a * 1) = a + a = S(...S(a)) a times
What a fucking ratardo is this
You don't do multiplications like that in binary retard. You shift bits just like in divide thus it's the same for computer which one is done thus divide by zero applies to multiplication
result: 0
this was easy
HOW THE FUCK IS THIS THREAD SO LONG WTF IT'S JUST 16 CAN YOU SHUT UP ALREADY
Base doesn't matter for the definition, since the entire set is built recursively
0 = {}
S(n) = n U {n}
1 := S(0) = 0 U {0} = {} U {{}} = {{}}
2 = 10 := S(1) = 1 U {1} = {{}} U { {{}} } = {{}, {{}}}
Hence
>You don't do multiplications like that in binary retard. You shift bits just like in divide
Is false, what you're referring to is a division algorithm, and is purely implementation
Moreover, division in the integers is not defined as it is with computers, rather, you have the division theorem (for all a,b, there exists q and r, with 0