MuffinMonster

Class Task 8#

Oct 8th, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.73 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication4
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int i1, i2 = 0, i3, x = 0;
  14.             Console.WriteLine("Enter a number:");
  15.             i1 = int.Parse(Console.ReadLine());
  16.             i3 = i1;
  17.             while (i3 > 0)
  18.             {
  19.                 i3 /=10;
  20.                 x++;
  21.             }
  22.             for (; x > 0; x--)
  23.             {
  24.                 i3 = i1 % 10;
  25.                 i1 /= 10;
  26.                 i2 = i2 * 10 + i3;
  27.             }
  28.             Console.WriteLine(i2);
  29.             Console.ReadKey();
  30.         }
  31.     }
  32. }
Add Comment
Please, Sign In to add comment