C Program Convert Decimal to Octal

Advertisements

Prev Tutorial Next Tutorial

Convert Decimal to Octal Program in C

With the help of C Language you can convert any number from decimal to Octal. Decimal number have base 10 and Octal number have base 8.

Decimal Number System

The decimal numeral system (also called base-ten and occasionally called denary) has ten as its base, which, in decimal, is written 10, as is the base in every positional numeral system. It is the numerical base most widely used by modern civilizations

Octal Number System

The octal numeral system, or oct for short, is the base-8 number system, and uses the digits 0 to 7. Octal numerals can be made from binary numerals by grouping consecutive binary digits into groups of three (starting from the right).

Decimal to Octal Conversion Program in C

#include<stdio.h>
#include<conio.h>

void main()
{
int no,rem[20],i=0,j;
clrscr();
printf("Please Enter any Decimal Number: ");
scanf("%d",&no);
while(no>0)
{
rem[i]=no%8;
i++;
no=no/8;
}
printf("Octal number is:");
for(j=i-1; j>=0; j--)
{
printf("  %d",rem[j]);
}
getch();
}

Output

Please Enter any Decimal Number: 23
Octal number is: 2  7

Prev Tutorial Next Tutorial

Advertisements

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Pure VPN Privide Lowest Price VPN Just @ $1.65. Per Month with Non Detected IP Lowest Price Non Detected IP VPN

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements