Write a C++ Programs to convert Octal number to Decimal number

Write a C++ Programs to convert Octal number to Decimal number #include #include using namespace std; int main() { int num,temp



Anonymous School 🏫

            (Minds of Hacker)

----------------------


 Write a C++ Programs to convert Octal number to Decimal number


C++ Practical



#include<iostream>
#include<math.h>
using namespace std;
int main()
{
    int num,temp,reminder,sum=0,i=0;
    cout<<"Enter the octal number\n";
    cin>>num;
    temp=num;
    while(temp!=0)
    {
        reminder = temp%10;
        sum=sum+reminder*pow(8,i++);
        temp=temp/10;
    }
    cout<<"\nDecimal Number number= "<<sum;
}


Output:



Enter the octal number 10 Decimal Number number= 8





 ****************Don't Make Learning Hard*****************

  Follow Us  



NextGen Digital... Welcome to WhatsApp chat
Howdy! How can we help you today?
Type here...