Advertisement
Vickyyy01

Untitled

May 31st, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 KB | None | 0 0
  1. using System;
  2. using System.Numerics;
  3.  
  4. public class CBTDecimal
  5. {
  6.     public static void Main()
  7.     {
  8.         string input = Console.ReadLine();
  9.         string[] cut = input.Split(new char[0], StringSplitOptions.RemoveEmptyEntries);
  10.         double numBase = double.Parse(cut[0]);
  11.         string number = cut[1];
  12.         int length = number.Length;
  13.         double result = 0;
  14.         double power = 0;
  15.  
  16.         for (int i = length - 1; i >= 0; i--)
  17.         {
  18.             string numerator = number[i].ToString();
  19.             result += Math.Pow(numBase, power)*double.Parse(numerator);
  20.             power++;
  21.         }
  22.  
  23.         Console.WriteLine(result);
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement