Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Homework 4 You must write a C program that prompts the user for two numbers ( no command line input ) and multiplies them together

Homework 4 You must write a C program that prompts the user for two numbers (no command line input) and multiplies them together using a la russe multiplication. The program must display your banner logo as part of the prompt to the user. The valid range of values is 0 to 4000. Assume that the user will always enter numerical decimal format values. Your program should check this numerical range and re-prompt the user for correct input if necessary. The program must also allow the user to enter a character to exit the program back to the terminal prompt. The program should print the result in decimal format and binary format. The binary output should use the least number of bits to display the number in multiples of 8 bits. I.e., anything less than 256 should display as 8 bits, anything less than 64k should use 16 bits. The value 4000 times 4000 should only need 24 bits. You may NOT use any libraries other than stdio.h You may NOT use the multiplication operator or the division operator o Use bitwise shifting to halve and double numbers You must use two source files o One source file will contain the main() function, global variables, and proper function prototypes. o The other source file will contain all other functions as specified below o The program must be built using the compile command like Tutorials Point p27 You must have the following four functions o One function that prints your logo banner -note(already have this part so ignore) o One function that takes in a value and prints it in binary format o One function that prompts the user for input and qualifies those values o One function that takes in the two values, multiplies them and returns the result. Your program must keep the two numbers and the result in global variables There can be no magic numbers in the code o Any constants must be defined with a Macro Your code must adhere to the coding guidelines posted in the Guidelines section of the EE1311 Helpful Resources page (see Wiki) Upload both source files together to the Blackboard assignment. You one submission to upload both files. Do not zip the files together. Hint: You will likely need a while loop to process the values during the multiplication algorithm. Use printf() statements liberally throughout the code (especially within loops to display data to the screen during execution). Display all relevant values during the algorithm to analyze what is happening during your program. When the code is working, comment out the printf() statements, but do not erase them. Leave them there in case you want to enable them

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

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

More Books

Students also viewed these Databases questions