Coders Packet

Convert Decimal Number to a Number with base N in C++

By Jay Parmar

A simple C++ program that lets you convert a decimal number (base 10) to a base N number using an array of characters

The code consist of a C++ approach of converting a decimal number into a number with base given by the user.


Code asks the user to enter a number in base-ten (10) and a base in which the code has to calculate the value of!


We can convert our number to Binary, Octal or in any base upto Hexadecimal.


If the user inputs a base less than Binary (2) or more than Hexadecimal (16), the process terminates the program and exits the code.


Here's a snapshot of how the program appears:


Decimal to Binary

Download Complete Code


No comments yet