Featured
- Get link
- X
- Other Apps
C++ program to convert octal to decimal
/*Following program converts Octal Number to its Decimal Equivalent
*/
#include<iostream.h>
#include<conio.h>
#include<math.h>
void octal2dec(long num)
{
int i=0,rem;
long sum=0;
while(num>0)
{
rem=num%10;
sum=sum+rem*pow(8,i);
i++;
num=num/10;
}
cout<<"Decimal Equivalent is<< "<<sum;
}
void main()
{
clrscr();
long n;
cout<<"\nEnter An Octal Number\n";
cin>>n;
octal2dec(n);
getch();
}
OUTPUT:
*/
#include<iostream.h>
#include<conio.h>
#include<math.h>
void octal2dec(long num)
{
int i=0,rem;
long sum=0;
while(num>0)
{
rem=num%10;
sum=sum+rem*pow(8,i);
i++;
num=num/10;
}
cout<<"Decimal Equivalent is<< "<<sum;
}
void main()
{
clrscr();
long n;
cout<<"\nEnter An Octal Number\n";
cin>>n;
octal2dec(n);
getch();
}
OUTPUT:
- Get link
- X
- Other Apps
Labels:
C++ program to convert octal to decimal
Octal to decimal conversion
octal to decimal conversion program in C++
Popular Posts
C++ program to display numbers which get reversed after multiplying by 4
- Get link
- X
- Other Apps
Comments
Post a Comment