#include<iostream>
#include<conio.h>
#include<math.h>
using namespace std;
int Octal_to_Decimal(long n)
{
int decimal_number = 0, i = 0, remainder;
while(n!=0)
{
remainder = n%10;
n = n/10;
decimal_number = decimal_number + (remainder*pow(8,i));
++i;
}
return decimal_number;
}
int main()
{
long num;
cout<<"Enter an octal number : ";
cin>>num;
cout<<"Octal Number "<<num<<" is equal to "<<Octal_to_Decimal(num)<<" Decimal Number."<<endl;
getch();
return 0;
}
Showing posts with label Find decimal of octal number. Show all posts
Showing posts with label Find decimal of octal number. Show all posts
Sunday, 22 October 2017
Convert Octal Number to Decimal Number in c++
Subscribe to:
Posts (Atom)
Python Program to find Fabonacci
fabtab={} def fabonacci(n): fabtab[0]=0 fabtab[1]=1 for i in range(2,n+1): fabtab[i]=fabtab[i-1]+fabtab[i-2] ...
-
#include< iostream > #include< conio.h > #include< math.h > using namespace std; int Octal_to_Decimal(long n) { ...
-
#include< iostream > #include< conio.h > #include< math.h > using namespace std; int Octal_to_Binary(long n) { ...
-
#include iostream > #include conio.h > using namespace std; int main() { float lenght, breath; doubl...
