Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use C for two functions: print integer(int n, int radix, char* prefix) with return type : void Print the number n to the console (stdout)

use C for two functions:

print integer(int n, int radix, char* prefix) with return type: void

  • Print the number n to the console (stdout) in the specified number base (radix), with the prefix immediately before the first digit. radix may be any integer between 2 and 36 (inclusive). n may be any int. For values of radix above 10, use lowercase letters to represent the digits following 9. print_integer() should not print a newline ('n' or 'r'). Examples:

    • print integer(768336, 10, "") should print 768336 because the number seven-hundred sixty-eight thousand three-hundred thirty-six would be written as 768336 in base 10 (decimal).
    • print integer(-768336, 10, "") should print -768336.
    • print integer(-768336, 10, "$") should print -$768336. Notice that the prefix ("$") comes after the "-" and before the first digit.
    • print integer(768336, 16, "") should print bb950 because the number seven-hundred sixty-eight thousand three-hundred thirty-six would be written as bb950 in base 16 (hexadecimal).
    • print integer(768336, 16, "0x") should print 0xbb950. The 0x prefix is added only because it is passed as an argument to print_integer().
    • print integer(-768336, 16, "0x") should print -0xbb950.
    • print integer(-768336, 2, "0b") should print -0b10111011100101010000.
    • print integer(768, 10, ""); print integer(-336, 10, "") should print "768336".

******Use fputc and stdout instead of printf

******Can't use arrays to store strings

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

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions

Question

=+What is the most that you should pay to complete development?

Answered: 1 week ago

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago