Answers for "c# check number is odd or even"

C#
5

check if number is even or odd c#

int i = 5;
if (i % 2 == 0)
{
	// even
}
else
{
	// odd
}
Posted by: Guest on December-22-2019
0

c# check number is odd or even

static int counter = 0;
    public int maxstrairs = 100;
    
    void Start()
    {
        counter++;
        if(counter < maxstrairs)
        {
            dothestairs();
        }

    }

    private void dothestairs()
    {
        if (counter % 2 == 0)
        {
            // even
        }
        else
        {
           // odd
        }
    }
Posted by: Guest on August-11-2021

Code answers related to "c# check number is odd or even"

C# Answers by Framework

Browse Popular Code Answers by Language