this post was submitted on 14 Apr 2024
328 points (94.1% liked)

linuxmemes

21031 readers
516 users here now

Hint: :q!


Sister communities:


Community rules (click to expand)

1. Follow the site-wide rules

2. Be civil
  • Understand the difference between a joke and an insult.
  • Do not harrass or attack members of the community for any reason.
  • Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
  • Bigotry will not be tolerated.
  • These rules are somewhat loosened when the subject is a public figure. Still, do not attack their person or incite harrassment.
  • 3. Post Linux-related content
  • Including Unix and BSD.
  • Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of sudo in Windows.
  • No porn. Even if you watch it on a Linux machine.
  • 4. No recent reposts
  • Everybody uses Arch btw, can't quit Vim, and wants to interject for a moment. You can stop now.

  • Please report posts and comments that break these rules!

    founded 1 year ago
    MODERATORS
     
    you are viewing a single comment's thread
    view the rest of the comments
    [–] [email protected] 7 points 6 months ago (5 children)

    Not one person in the comments has attempted to answer any of the questions either.

    [–] [email protected] 15 points 6 months ago

    Haha good try. Hope your interview goes well

    [–] [email protected] 14 points 6 months ago (2 children)

    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

    [–] [email protected] 5 points 6 months ago

    Thank you holy shit I was beginning to think no one has ever seen a fizz buzz before

    [–] [email protected] 4 points 6 months ago (1 children)

    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);
    }
    
    [–] [email protected] 3 points 6 months ago

    Strictly speaking this one does not find the odd numbers, it just prints them.

    [–] [email protected] 13 points 6 months ago

    for (i%1=0; i+2; int) odd++; cout(3)

    [–] [email protected] 1 points 6 months ago

    (0..=100).filter(|n| n % 2 == 1).for_each(|n| println!("{n}"))

    [–] [email protected] 1 points 6 months ago (1 children)

    Will you give me the position if I answer the problems? 😀

    [–] [email protected] 1 points 6 months ago

    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.