Home > Back-end >  Just learning C don't know how to write the code, for a great god for help
Just learning C don't know how to write the code, for a great god for help

Time:10-06

The problem is octal turn decimal
Int main (void) {
C, unsigned int num=0, ct=0;

Printf (" both Please input a positive octal integer and end with pressing the Enter: \ n ");

//Read the octal string, at most 10 characters.
While ((c=getchar ())!='\ n' & amp; & . ) {

...
}
//If the input is not valid, the output of the error message.
if (c ! )='\ n' {
Printf (" ERROR: the input should be an octal string containing 0 to 7, with length less than 11! \n");
} else {//the Output, the conversion table.
Printf (" I \ t8 ^ I \ tdigit \ tproduct \ n ");
.

//the Output of the decimal value
Printf (" a Decimal value: % d \ n ", num);
}

return 0;
}
  • Related