Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

how to find how much digits in number c#

Math.Floor(Math.Log10(n) + 1);
//find how much digit in number
//decimal point will not be added
Comment

mfind how many digits a number has c#

static int digitCountOf(int number){
            return number.ToString().Length;
        }
Comment

how to count digits of number in c#

//recursion
//input: 123
//output: 3           :)
static int CountDigits(int num, int count)
        {
            if (num == 0)
            {
                return count;
            }

            return CountDigits(num / 10, ++count);
        }
static void Main(string[] args)
        {
            Console.WriteLine(CountDigits(123, 0));
         }
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# array last element 
Csharp :: c# string to char 
Csharp :: disable script in unity 
Csharp :: windows forms iterate through all controls 
Csharp :: why vue cli do not refresh auto in local host 
Csharp :: mymove() method c# 
Csharp :: unity vector3.distance giving nonsensical values 
Csharp :: unity button addlistener 
Csharp :: unity3d quaternion add 90 degrees 
Csharp :: byte to stream c# 
Csharp :: C# multiple button click event to password textbox 
Csharp :: c# check valid datetime 
Csharp :: unity length of string 
Csharp :: unity how to end a game with esc 
Csharp :: c# process start 
Csharp :: aabb collision with direction 
Csharp :: play sound unity 
Csharp :: c# get files of type in directory 
Csharp :: unity set active for seconds 
Csharp :: c# dynamic object get value 
Csharp :: unity knowing when 0 input is pressed 
Csharp :: Tower of Hanoi c# 
Csharp :: exit programm c# 
Csharp :: unity keycode 
Csharp :: unity up arrow input 
Csharp :: c# getforegroundwindow 
Csharp :: C# HttpClient POST request 
Csharp :: c# func with no return 
Csharp :: unity smooth rotation 2d 
Csharp :: how to clear datagridview c# 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =