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 :: basic of c# sockets 
Csharp :: subtract days c# 
Csharp :: C# network traffic 
Csharp :: wpf get function name 
Csharp :: append multi lines to file linux 
Csharp :: how to check if the value is alphabet and numbers only only in c# 
Csharp :: unity post processing on UI 
Csharp :: group by ef core 
Csharp :: c# wpf image source from resource programmatically 
Csharp :: c# datetime blank 
Csharp :: c# handle dbnull value 
Csharp :: c# list.foreach 
Csharp :: c# int 
Csharp :: c# clear an array 
Csharp :: how to load file from resources in c# 
Csharp :: c# backup sql 
Csharp :: what value of combobox index c# 
Csharp :: vb.net remove last comma from string 
Csharp :: .net core 6 autofac 
Csharp :: how to show process time run c# 
Csharp :: array declaration in c# 
Csharp :: c# chunk array linq 
Csharp :: callling class c# 
Csharp :: c# comment 
Csharp :: c# lambdas 
Csharp :: delete all rows from table linq 
Csharp :: new list/array with values c# 
Csharp :: .net 4.5 use tls 1.2 
Csharp :: entity framework with query C# 
Csharp :: deactivate a gameobject unity 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =