# How to convert decimal to octal using turbo c!

Page 1 of 1

## 2 Replies - 18861 Views - Last Post: 12 September 2007 - 10:43 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=32887&amp;s=50aa23c8279fbc88136ba07171d736ca&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 dude_55_killua

Reputation: 0
• Posts: 2
• Joined: 08-September 07

# How to convert decimal to octal using turbo c!

Posted 08 September 2007 - 07:32 AM

I really need your reply because our project will be pass on tuesday(september 11,2007)!!!!

SAMPLE OUTPUT:

Enter a decimal number: 20
OCTAL: 24

here's how to convert you just divide the decimal number to 8 then get the remainder. But in manual computing the remainder arrange by ascending number but i need to show it by descending order!!!!!!!!!
Is This A Good Question/Topic? 0

## Replies To: How to convert decimal to octal using turbo c!

### #2 PennyBoki

• system("revolution");

Reputation: 53
• Posts: 2,335
• Joined: 11-December 06

## Re: How to convert decimal to octal using turbo c!

Posted 08 September 2007 - 08:29 AM

Hi, there are snippets here that can give you the result you want, check:

http://www.dreaminco.../snippet882.htm

http://www.dreaminco.../snippet888.htm

just check out the snippets you could get the idea

### #3 YasirMX

Reputation: 0
• Posts: 30
• Joined: 12-September 07

## Re: How to convert decimal to octal using turbo c!

Posted 12 September 2007 - 10:43 AM

dude_55_killua, on 8 Sep, 2007 - 07:32 AM, said:

I really need your reply because our project will be pass on tuesday(september 11,2007)!!!!

SAMPLE OUTPUT:

Enter a decimal number: 20
OCTAL: 24

here's how to convert you just divide the decimal number to 8 then get the remainder. But in manual computing the remainder arrange by ascending number but i need to show it by descending order!!!!!!!!!

pretty easy: use modulus operator to "pick off" digit

for e.g :
``` if ( n % 8 != 0)
{
int remainder = n%8;

```

proceed like this until you get all the remainders