#include<iostream>
using namespace std;
int main()
{
int b = 1, c;
unsigned long long int s = 0, a;
cout << "Enter Octal Number : ";
cin >> a;
cout << endl;
while(a != 0)
{
c = a%10;
s = s + (c * b);
a = a/10;
b = b*8;
}
cout << "Decimal Number :: " << s << endl;
return 0;
}
using namespace std;
int main()
{
int b = 1, c;
unsigned long long int s = 0, a;
cout << "Enter Octal Number : ";
cin >> a;
cout << endl;
while(a != 0)
{
c = a%10;
s = s + (c * b);
a = a/10;
b = b*8;
}
cout << "Decimal Number :: " << s << endl;
return 0;
}
Comments
Post a Comment