Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

explanation with comments would be very helpful Problem B B.1 Specification Write a C program to input an octal number in the form of a

image text in transcribed

explanation with comments would be very helpful

Problem B B.1 Specification Write a C program to input an octal number in the form of a line of characters and store the input characters in an array. Convert the octal number to a decimal integer and display the decimal integer on the standard output using printf. B.2 Implementation The program is named lab3b.c. Use the given template lab3b.cand fill in your code. You are given an array of characters of size MAX SIZE where MAX SIZE = 100. The array is named my_strg. Use getchar and a loop to read an octal number in the form of a line of characters, and store the input characters into array my strg. The loop terminates when a new line character ' ' is entered. The new line character ' ' is NOT part of the line (i.e., discard the new line character '). Convert the octal number stored in array my_strg to a decimal integer. Display on the standard output the decimal integer using the printf statement as follows: printf( "8d ", my_int ) ; If the input string does not contain a valid octal number, display on the standard output the error message "Error: not an octal number". B.3 Sample Inputs/Outputs indigo 356 lab3b 12 10 indigo 357 lab3b 340 224 358 + lab3b indigo -340 -224 indigo 359 lab3b indigo 359 lab3b 29 Error: not an octal number 360 $ lab3b indigo abc Error: not an octal number Repeat Problem B, except that the input now is a line of characters containing a hexadecimal number. The hexadecimal digits 'A' to 'F' can be in upper case or lower case. named lab3c.c. Use the given template lab3c.cand fill in your code. The program Sample Inputs/Outputs indigo 361 lab3c indigo 362 lab3c 10 16 indigo 363 lab3c -920 -2336 EECS 2031 Page 4 of 4 indigo 364 lab3c DE 222 indigo 365 lab3c 1bc6 7110 indigo 364 lab3c 2R3 Error: not a hexadecimal number

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OCA Oracle Database SQL Exam Guide Exam 1Z0-071

Authors: Steve O'Hearn

1st Edition

1259585492, 978-1259585494

More Books

Students also viewed these Databases questions

Question

What does this public not want on this issue?

Answered: 1 week ago

Question

What does this public want on this issue?

Answered: 1 week ago