Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

check if number is even or odd c#

int i = 5;
if (i % 2 == 0)
{
	// even
}
else
{
	// odd
}
Comment

odd or even in c#

if(num %2 == 0){
  Console.WriteLine("Number is even")
}else{
  Console.WriteLine("Number is odd")
}
Comment

c# is odd number

// using modulo operator %
if(num%2 == 0){
  Console.WriteLine("Number is even")
}else{
  Console.WriteLine("Number is odd")
}
Comment

c# even or odd

int x = 2;
if(x % 2 == 0){
    Console.WriteLine("Is even");
}
else
{
    Console.WriteLine("Is odd");
}
Comment

c# odd or even

namespace ConsoleApp1
{
    internal class Program
    {
        static void Main(string[] args)
		{
			int x = 6;
            if (x % 2 == 0)
            {
                Console.WriteLine("x is even");

            } else if   (x % 2 == 1)
            {
                Console.WriteLine("x is odd");
            }
		}
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: how to move towards an object unity 
Csharp :: unity nested list 
Csharp :: unity how to load a scene 
Csharp :: WebClient c# with custom user agent 
Csharp :: how to pass class type to method c# 
Csharp :: .net core check if user is logged in 
Csharp :: memset alternative in c# 
Csharp :: unity point between two positions 
Csharp :: how to name GameObject in c# 
Csharp :: How to get an array of months in c# 
Csharp :: unity 2d player move 
Csharp :: c# 
Csharp :: create material unity script 
Csharp :: make window not resizable wpf 
Csharp :: unity keycode for f 
Csharp :: how to print dictionary in c# 
Csharp :: how to make a global string c# 
Csharp :: c# string array contains 
Csharp :: c# convert split to list 
Csharp :: c# find element by condition 
Csharp :: Celsius to Fahrenheit c# 
Csharp :: c# color hex 
Csharp :: defaultrequestheaders.authorization basic auth 
Csharp :: convert string to int c# 
Csharp :: unity event 
Csharp :: how to look for substring in string in c# 
Csharp :: Razor if-else statement 
Csharp :: unity ui movement 
Csharp :: c# get last 3 characters of string 
Csharp :: c# read lines number 3 from string 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =