Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 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 ConsoleApplication55
  8. {
  9.     class Program
  10.     {
  11.  
  12.         static void Main(string[] args)
  13.         {
  14.             string a = "14";
  15.             int b = 13;
  16.             int c = 8;
  17.             try
  18.             {
  19.                 if (b == 13)
  20.                 {
  21.                     int temp = Convert.ToInt32(a, b);
  22.                     Console.WriteLine(Convert.ToString(temp, c));
  23.                 }
  24.                 else
  25.                 {
  26.                     Int64 temp = Convert.ToInt64(a, b);
  27.                     Console.WriteLine(Convert.ToString(temp, c));
  28.                 }
  29.             }
  30.                catch(Exception)
  31.             {
  32.               Console.WriteLine("Некорректное значение параметра!");
  33.             }
  34.  
  35.             Console.ReadLine();
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement