Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,094 questions

40,775 answers

573 users

How to separate groups of digits in numeric literals with underscore in C#

4 Answers

0 votes
using System;

public class Program
{
	public static void Main(string[] args)
	{
		long creditCardNumber = 1234_5678_9101_1129L;
		
		Console.WriteLine("Credit Card Number: " + creditCardNumber);
	}
}



/*
run:
  
Credit Card Number: 1234567891011129
  
*/

 





answered Aug 1, 2022 by avibootz
0 votes
using System;

public class Program
{
	public static void Main(string[] args)
	{
		float pi =  3.14_15_92F;
         
        Console.WriteLine("PI: " + pi);
	}
}



/*
run:
  
PI: 3.141592
  
*/

 





answered Aug 1, 2022 by avibootz
0 votes
using System;

public class Program
{
	public static void Main(string[] args)
	{
		long hexLong = 0x5F_3A_DE_BD;
         
        Console.WriteLine("Hex long: " + hexLong);
	}
}



/*
run:
  
Hex long: 1597693629
  
*/

 





answered Aug 1, 2022 by avibootz
0 votes
using System;

public class Program
{
	public static void Main(string[] args)
	{
		byte binByte = 0b0010_0111;
         
        Console.WriteLine("binByte: " + binByte);
	}
}



/*
run:
  
binByte: 39
  
*/

 





answered Aug 1, 2022 by avibootz

Related questions

1 answer 74 views
1 answer 64 views
1 answer 132 views
...