Question
this lab should be done with the gcc compiler under Cygwin. You must write a command line C program that takes two positive decimal numbers
this lab should be done with the gcc compiler under Cygwin.
You must write a command line C program that takes two positive decimal numbers as arguments when
the program is executed and multiplies the two numbers using Russian or a la russe multiplication.
This will require the use of the left and right shift operation in C as well as the modulus operator. You
will also need the atoi() function which requires the inclusion of the stdlib.h header file in the program.
The range of each number at the command line should be restricted to between zero and 255 decimal.
Your program should check for this condition and report any input error to the user. Your program
should check for any other garbage input from the command line and prompt the user appropriately.
In addition to printing out the result as a decimal value using the printf() function, your program must
print out the result in binary form. This cannot be done directly with printf(), so you will have to write a
function that takes in the ?? bit value and prints each bit of the value to the screen. This will require the
use of C bitwise operators.
The binary value should be written with the MSB to the left and LSB to the right as you would write it
out on paper.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started