Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

C code for converting decimal number into N base number

Status
Not open for further replies.

jaywee03

Newbie level 4
Newbie level 4
Joined
Jul 13, 2004
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
54
functions in c

d :) oes anyone have a code or can you recomend a site were i can find a code that converts a decimal number into its equivalent N base no.(using functions). thanx!!!! :eek:
 

Re: functions in c

Cant realy give a link for this paticular function.
but have you tried **broken link removed** have loads of stuff.
 

Re: functions in c

Hi,
You have to write your own function. It is quite easy.

start with

int conv(int base, long num)
{
rem = num%base.
num = num-rem.
rem gives the last byte
num is divisible base.


}
 

Re: functions in c

int convert(int base,long num)
{
while(n)
{
B=num%base;
num=num/base;
c[n]=B;
n=n-1;
}
}

n is data length based on some base.
B is middle variable.
num is data.

note: output c is reverse order.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top