stefan1919

ReverseNumber

Sep 25th, 2015
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 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 ConsoleApplication7
  8. {
  9.     class Program
  10.     {
  11.  
  12.         static void Main(string[] args)
  13.         {
  14.             float number = float.Parse(Console.ReadLine());
  15.             Console.WriteLine(ReverseNumber(number));
  16.         }
  17.        
  18.         private static string ReverseNumber(float number)
  19.         {
  20.             string digits = number.ToString();
  21.             char[] array = digits.ToCharArray();
  22.             string output = string.Empty;
  23.             for (int i = array.Length - 1; i >= 0 ; i--)
  24.             {
  25.                 output += array[i].ToString();
  26.             }
  27.             return output;
  28.         }
  29.    
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment