C Program To Convert Decimal Number To Octal Number, using While Loop

Опубликовано: 29 Сентябрь 2024
на канале: Technotip
15,250
222

http://technotip.com/7006/c-program-t...

Lets write a C program to convert a number from Decimal number system(base 10) to Octal number system(base 8), using while loop.

Expected Output for the Input
User Input:
Enter a decimal number
20

Output:
Octal equivalent of 20 is 24.

Explanation:
If user enters num = 20

We keep on dividing the number 20 by 8.

20 / 8 = 2, reminder 4.
02 / 8 = 0, reminder 2.

So Octal equivalent of decimal number 20 is 24.

C Programming Interview / Viva Q&A List
http://technotip.com/6378/c-programmi...

C Programming: Beginner To Advance To Expert
http://technotip.com/6086/c-programmi...