Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C program that prompts the user for two numbers and multiplies them using a la russe multiplication. No input is allowed at execution

image text in transcribed
Write a C program that prompts the user for two numbers and multiplies them using \"a la russe" multiplication. No input is allowed at execution time (no command line input}. The numbers must be entered both at the same time (space or tab between entries}. The program must display your banner logo from HW1 as part of a prompt to the user. The valid range of values for each number is 0 to 24000. You may assume that the user will always enter numerical decimal format characters at the keyboard. Your program should check this numerical range (Including checking for negative numbers) and re-prompt the user for correct input if necessary. The program must also require the user to enter a single specific character of your choice to exit the program and return the main(} function 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. |.e., anything less than 256 should display as 8 bits, anything less than 64k should use 16 bits, etc. The value 24000 times 24000 should need 32 bits. I You may NOT use any libraries other than stdio.h and stdlib.h {no math.l1) I You may NOT use the multiplication operator or the division operator 0 Use bitwise shifting to halve and double numbers 0 Use modulus to detect if a value is even or odd I There can be no "magic numbers\" in the code 0 Any constants must be defined with a properly named #define macro I You must use two source files and one header le 0 The header file must contain all MACRO's and function prototypes 0 One source file must contain only the mainll function, and any global variables. 0 The other source file will contain all other functions as specified below 0 The program must be built using the compile command like Tutorials Point (pdf p27 - end of Chapter 8) I You must have at least the following four functions in addition to main 0 One function that prints your logo banner 0 One function that takes in a value and prints it in binary format 0 One function that prompts the user for input and qualifies those values 0 One function that takes in the two values, multiplies them and returns the result I Your program must keep the two input values and the result in global variables I Your code should strive to adhere to the coding guidelines posted here: htt s: www.cs.swarthmore.edu \"newhall unixhel c codest |e.htm| Upload both source les and header file to Canvas assignment. Use one submission to upload all files. Do not zip the les together. Hint: You will need a while loop to process the values during the multiplication algorithm. Use printh statements liberally throughout the code (especially within loops) to display data to the screen during execution for debugging purposes. Display all relevant values during the algorithm to analyze what is happening during your program. When the code is working, comment out the printfl) statements, but do not erase them. Leave them in case you want to anal-tin than\" in.- Suns-Inn- mink-Inning Ina-nu

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

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions