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 Problem30
- {
- class Program
- {
- static void Main(string[] args)
- {
- int t = int.Parse(Console.ReadLine());
- for (int i = 0; i < t; i++)
- {
- int n = int.Parse(Console.ReadLine());
- Console.WriteLine(Zamien(n, 16));
- Console.WriteLine(" ");
- Console.WriteLine(Zamien(n, 11));
- }
- }
- private static string Zamien(int n, int podstawa)
- {
- char[] tab = new char[50];
- char[] znaki = "0123456789ABCDEF".ToCharArray();
- int index = 0;
- for (; n != 0; n /= podstawa)
- {
- tab[index++] = znaki[n % podstawa];
- }
- string tekst = "";
- for (int i = 0; i < tab.Length && tab[i] != 0; i++)
- {
- tekst = tab[i] + tekst;
- }
- return tekst;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement