76 361
Assignments Done
Successfully Done
In May 2019

Answer to Question #23786 in C++ for EMMANUEL

Question #23786
write a program which inputs an octal number and outputs its decimal equivalent. the following example illustrates the expected behaviour of the program:
input an octal number : 214
octal(214) = Decimal (532)
Expert's answer
#include <iostream>

void main(){
int oct0, oct, dec = 0, a = 1, r, t = 1;
std::cout<<"enter an octal number: ";
oct0 = oct;
while (oct0 != 0)
r = oct0%10;
oct0 = oct0/10;
dec += t*r;
t *= 8;
std::cout<<"octal("<<oct<<") = decimal("<<dec<<")\n";

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions