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

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 :: get index of item unity 
Csharp :: c# second last index 
Csharp :: transform face player unity 
Csharp :: parsons it solutions 
Csharp :: asp net core send email async 
Csharp :: C# IEnumerable access element at index 
Csharp :: unity getcomponent transform.position 
Csharp :: MailChimp C# Api calls 
Csharp :: how do i repeat a button on visual studio code 
Csharp :: get file id from mongodb without objectid using c# 
Csharp :: weakreference tryget c# 
Csharp :: 10x10 table matrix C# 
Html :: html dollar symbol 
Html :: html tab icon 
Html :: how to open link in new tab 
Html :: rs logo html 
Html :: html chevron 
Html :: html tab space 
Html :: how to change the preview image of a website 
Html :: html theme meta 
Html :: add space in html 
Html :: set icon website 
Html :: js onclick redirect 
Html :: & in html 
Html :: link javascript to html 
Html :: html star symbol 
Html :: how to embed audio in html 
Html :: how to make a link in hml 
Html :: ngfor with index 
Html :: how to set link as normal text in html 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =