General code 3
CODE NO:- 18 Q) C program to convert a binary number to octal number. Input: 101 Output: 5 Input: 11010 Output: 32 Test Case: ------------- (1) Valid Input: (a) Only number consisting of 0s and 1s will be given as input (2) Invalid inputs: (a) Decimal ( b) Fraction (c) String (d) Two or more command-line arguments (e) Negative number (3)You should generate output as follows: (a) For right output print just the actual Octal Value to STDOUT without any other text. (b) If any error: print 'ERROR' to the STDOUT without any other text. #LOGIC First, we need to convert the Binary no. into in Decimal no. then convert the decimal no. to octal no. . #Program( In C): In C language we use ' // ' for Single line comment and /*---*/ for multi line comment ...