Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

check if number is even or odd c#

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

how to check if a number is even in c#

int num = 100;

if (num % 2 == 0){
  Console.WriteLine($"{num} is an even number");
}
else if (num % 2 != 0){
  Console.WriteLine($"{num} isn't an even number");
}

// wait before closing
Console.ReadKey();
Comment

c# is odd number

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

how to see if a number is even c#

bool IsEven = ( number %2) == 0
bool IsOdd = ( number %2) == 1
Comment

PREVIOUS NEXT
Code Example
Csharp :: how to use double in c# 
Csharp :: c# gettype 
Csharp :: update table in C# 
Csharp :: euler to quaternion 
Csharp :: div element position in screen 
Csharp :: c# object list to joined string 
Csharp :: onmousedown() not working unity 
Csharp :: math with c sharp 
Csharp :: C# Find first thing on a list 
Csharp :: select range in list c# 
Csharp :: how to add skybox in unity 
Csharp :: Call Thread in C# 
Csharp :: linq map array 
Csharp :: c# convertir caracter con tilde 
Csharp :: C# one line method 
Csharp :: c# list any retun indec 
Csharp :: multiply structs c# 
Csharp :: conncet oracle database in c# visual studio 
Csharp :: get script directory c# 
Csharp :: c# object is enum 
Csharp :: unity deactivate scripts in list 
Csharp :: referans tipi nedir c# 
Csharp :: button event trigger wpf 
Csharp :: wpf StrokeDashArray 
Csharp :: rgb to console color 
Csharp :: generate a dropdown list from array data using razor .net mvc 
Csharp :: c# 10 null checl 
Csharp :: unity GUI TextField enter 
Csharp :: ef core many to many fluent api 
Csharp :: convert json date to datetime c# 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =