Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _12.IntegerToBase
- {
- class Program
- {
- public static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- int toBase = int.Parse(Console.ReadLine());
- Algo(n, toBase);
- }
- static void Algo(int n, int toBase)
- {
- int remind = 0;
- string answer = "";
- while (n > 0)
- {
- remind = n % toBase;
- n /= toBase;
- answer = remind.ToString() + answer;
- }
- Console.Write(answer);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement