How to convert decimal to octal using turbo c!

I just want to know how to program this conversion!!!!

Page 1 of 1

2 Replies - 17666 Views - Last Post: 12 September 2007 - 10:43 AM Rate Topic: -----

#1 dude_55_killua  Icon User is offline

  • New D.I.C Head

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

How to convert decimal to octal using turbo c!

Post icon  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  Icon User is offline

  • system("revolution");
  • member icon

Reputation: 53
  • View blog
  • Posts: 2,334
  • 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
Was This Post Helpful? 1

#3 YasirMX  Icon User is offline

  • New D.I.C Head

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

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

Posted 12 September 2007 - 10:43 AM

View Postdude_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
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1