C program to convert Any Decimal Number to Octal Number :

To covert the Decimal Number to Octal Number in C programming , It is very easy. I will tell you the easiest way without any function without Array[] .You think How ? ok..let's read the post We all know about Ocatal and decimal Number.Decimal Number has 10 base(0-9 digit) and Octal Number has 8 base(0-7 digit).

As the same process we use in c programming .Hope you know basic C program . In C program we use '%c' for any character . Same we use here '%d' for decimal and '%o' for octal Number. It is the easiest way to convert Octal to Decimal.
In this post we will learn , how to convert Any Decimal Number to Octal Number by c programming. From above we get some basic knowledge about Decimal and Octal value.

See the table of octal and decimal number . You get a clear idea about the octal and decimal number.

 Decimal Octal 0 0 1 1 2 2 7 7 8 10 9 11 10 12 12 14 13 15

Let's learn , How to convert Decimal to Octal through a problem.

Once you will practice any program through the problem,It will help to remember the program and better understand the program.

Let Suppose a problem is :

Any number input through the keyboard . Write a program to convert Decimal Number to Octal Number.

>>To solve this problem ,

>>> we take '%d' for decimal and '%o' for octal Number.
It is the easy way to convert Decimal Number to Octal Numberr.
To understand better go to the code .

Let's Go to the code :

Note :Click on the button to copy the text from the text field. Try to paste the text (e.g. ctrl+v) afterwards in a different window, to see the effect.

write the above code or copy this code . save this with '.c ' extension.In this screen User have to input a number to convert Decimal Number to Octal Number .First input a decimal value Then press Enter to show octal value.

Out put :

Hope you understand if you face any problem comment below ,will try to help you.

Don’t forget to Subscribe our Blog to get update. Just put your email on subscribe box and hit subscribe button , next verify your email , it will be done.

You will get every single post when we will upload in Smartduniya.

Also learn this post :