Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Exercises
- {
- class Program
- {
- static double Right(int num)
- {
- int digits = 1, rep = num;
- double last;
- while (rep / 10 != 0)
- {
- digits++;
- rep /= 10;
- }
- last = num % 10 * Math.Pow(10, digits - 1);
- num /= 10;
- return num + last;
- }
- static void Main(string[] args)
- {
- int i, num;
- Random rnd = new Random();
- for (i = 0; i < 10; i++)
- {
- num = rnd.Next(46, 139);
- Console.WriteLine("Before: {0}, after: {1}", num, Right(num));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement