#include<iostream
>
#include<conio.h
>
#include<math.h
>
using namespace std;
int Octal_to_Binary(long n)
{
long binary_num = 0, decimal_num = 0, i = 0;
while(n!=0)
{
decimal_num = decimal_num + ((n%10) * pow(8,i));
++i;
n = n/10;
}
i = 1;
while(decimal_num!=0)
{
binary_num = binary_num + ((decimal_num % 2) * i);
decimal_num = decimal_num/2;
i = i*10;
}
return binary_num;
}
int main()
{
long num;
cout<<"Enter a octal number : ";
cin>>num;
cout<<"Octal Number "<<num
<<" is equal to "<<Octal_to_Binary(num)
<<" Binary Number."<<endl;
getch();
return 0;
}
Wednesday, 25 October 2017
Program to Convert Octal Number to Binary Number in c++
Subscribe to:
Post Comments (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 stdio.h > #include stdlib.h > #include conio.h > int arr[100], size=0; void insert_beg(); void insert_pos(); void inser...
-
#include iostream> #include conio.h > using namespace std; int main() { int n,num,first=0,middle,last; ...
-
#include iostream > #include conio.h > using namespace std; int main() { float radius; double area; ...
No comments:
Post a Comment