You're viewing a single thread.
_thebrain_ @sh.itjust.works Not one person in the comments has attempted to answer any of the questions either.
7 0 Replythemusicman @lemmy.world Haha good try. Hope your interview goes well
15 0 Replybasdiljhs @lemmy.world for(var i=0;i<=100;i++){ if((i%2)==1) console.log(i); }
btw % is the modulo operator, x%y returns the remainder of division of x by y
14 0 Replymoog @lemm.ee Thank you holy shit I was beginning to think no one has ever seen a fizz buzz before
5 0 ReplyLostXOR @fedia.io Slightly simpler, start at 1 and increment by 2 so you don't have to check whether i is odd.
for (var i = 1; i < 100; i += 2) { console.log(i); }
5 1 ReplyJeena @jemmy.jeena.net
Strictly speaking this one does not find the odd numbers, it just prints them.
4 1 Reply
Goun @lemmy.ml for (i%1=0; i+2; int) odd++; cout(3)
16 3 ReplyI Cast Fist @programming.dev
Will you give me the position if I answer the problems? 😀
1 0 Reply_thebrain_ @sh.itjust.works Sure! I'll hire you without even answering the questions. Of course I'm not the op, I dont work in the it field (any more) and none of my open positions involve programming... But you have a job with my company whenever you need one.
1 0 Reply
Bolt @lemmy.world (0..=100).filter(|n| n % 2 == 1).for_each(|n| println!("{n}"))
1 0 Reply