TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
harish reddy
NA
162
33.5k
Reverse a number - Decimal to Octal
Jan 3 2018 5:42 AM
Write a program in C# Sharp to convert a decimal number into octal without using an array.
I have done the proram til here:
int decimalnumber = int.Parse(Console.ReadLine());
int remainder;
for (int i = 0; i < 3; i++)
{
remainder = decimalnumber % 8;
int quotient = decimalnumber / 8;
decimalnumber = quotient;
Console.Write(remainder);
}
when i execute the program and give input as 117 for example, i am getting ouput as 561. However, i should be getting 165. Pls let me know how i can reverse them with out using array.
Reply
Answers (
5
)
How to read emails from *.pst file in c#
check if user already logged in