Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class TakeLastDigits
- {
- static void Main()
- {
- int num = 39524;
- Console.WriteLine("The number is: " + num);
- Console.WriteLine();
- int takeLastOneDigit = num % 10;
- Console.WriteLine("The last ONE digit is: " + takeLastOneDigit);
- int takeLastTwoDigits = num % 100;
- Console.WriteLine("The last TWO digits are: " + takeLastTwoDigits);
- int takeLastThreeDigits = num % 1000;
- Console.WriteLine("The last THREE digits are: " + takeLastThreeDigits);
- int takeLastFourDigits = num % 10000;
- // Er, you got the point....
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement