473,473 Members | 1,713 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Convert decimal number to any base (2-16)

13 New Member
I am working on a program where I have to enter a decimal number and enter a base and it converts according to base.

output:
Please enter a decimal number to convert: 15 <-input
What base would you like to convert to?(2-16)? 2 <-input
Decimal number converted to base 2 number is: 1111 <-output


Thank you
Dec 15 '06 #1
1 2673
Banfa
9,065 Recognized Expert Moderator Expert
then you should look up the functions

strtoul

and

itoa

which contain pretty much all the conversion functionality you require
Dec 15 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: whatluo | last post by:
Hi, all I'm now working on a program which will convert dec number to hex and oct and bin respectively, I've checked the clc but with no luck, so can anybody give me a hit how to make this done...
13
by: muss | last post by:
how to convert decimal number in a hexadecimal number using C? Please help me. Thanks.
32
by: saima | last post by:
a program that takes a decimal number input from the user and displays its binary number equivalent in 12 bits on the screen. For example: Enter a decimal number: 32 Its Binary Equivalent is : ...
14
by: dharmdeep | last post by:
Hi friends, I need a sample code in C which will convert a Hexadecimal number into decimal number. I had written a code for that but it was too long, I need a small code, so request u all to...
4
by: c2h | last post by:
pls help to solve this problem : using C programming to convert a base 8 number into a decimal number... thks
0
by: Metalpalo | last post by:
Hello everybody I created small batch file in MSDOS. In this batch file i need to print hexadecimal value of some env. variable. For example: I enter value via command :set /P PAR=Enter...
8
by: sdlt85 | last post by:
Hi, the program is asking the user for a number ant he base of the number, then it will convert the number to decimal. But is running right only with base 2, 3, 4, 5, 6, 7, 8 but if I try 16 it is...
2
by: marulasiddesh | last post by:
can any one help me out in converting a decimal number to binary number?
2
by: Hets | last post by:
Write a C program which can convert decimal number into binary number.
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.