• 0 Posts
  • 67 Comments
Joined 2 months ago
cake
Cake day: June 6th, 2025

help-circle


  • jaupsinluggies@feddit.ukto196@lemmy.blahaj.zonerule
    link
    fedilink
    English
    arrow-up
    18
    ·
    2 days ago

    I was confused recently at a border post marked “Passport control”. I had it ready, but the guard asked for my driving licence. While I was fishing for that he breathalysed me, which came back clean so he said I could go - without having seen either my passport or driving licence.

















  • This works for both positive and negative numbers:

    private static bool isEven(int number)
    {
    	bool result = true;
    
    	while (number < 0)
    	{
    		number = number - 1;
    		if (result == true)
    			result = false;
    		else
    			result = true;
    	}
    	while (number > 0)
    	{
    		number = number - 1;
    		if (result == true)
    			result = false;
    		else
    			result = true;
    	}
    	return result;
    }
    

    Output:

    isEven(4) = True
    isEven(5) = False
    isEven(-4) = True
    isEven(-5) = False