Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

Find last digit of a number in c#


        Console.WriteLine("Please write your number:");
        long n = long.Parse(Console.ReadLine());
 
        long lastDigit = n % (10);  //or int or double - whatever numeral data type suits you
        Console.WriteLine("The last digit of your number {0} is: {1}", n, lastDigit);
 
Source by forum.tutorials7.com #
 
PREVIOUS NEXT
Tagged: #Find #digit #number
ADD COMMENT
Topic
Name
6+8 =