Subscribe Us

C program to convert Any Octal Number to Decimal Number with out Array [ ] - smartduniya

C program to convert Any Octal Number to Decimal Number

octal to decimal in c

To covert the Octal value to Decimal value in C programming . I will tell you the easiest way without any function without Array[] . let's read 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 Octal Number to Decimal 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 Octal to Decimal Number through a problem.

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

Let Suppose a problem is :

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


> To solve this problem ,

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

Let's Go to the code :

octal to decimal number in c

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 octal to decimal .First input a octal value Then press Enter to show decimal value.

Out put :

Octal to decimal in c

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 :


How to write comment in C ?

How to write keyword, identifires in C ?

How to write Printf() function in C ?

Post a Comment

0 Comments