Question: Create an HLA Assembly language program that prompts for a value from the user and then prints the next six values starting with the value
Create an HLA Assembly language program that prompts for a value from the user and then prints the next six values starting with the value entered that are evenly divisible by six.
Here are some example program dialogues to guide your efforts:
Feed me:
Feed me:
Feed me:
In an effort to help you focus on building an Assembly program, Id like to offer you the following C statements which match the program specifications stated above. If you like, use them as the basis for building your Assembly program.
print the next six numbers evenly divisible by six
int answer ;
int x ;
int howMany ;
int evenlyDivisibleBy ;
printf "Feed Me: ;
scanfd &x ;
answer x;
int i ;
while i howMany
while answer
answer answer evenlyDivisibleBy;
if answer
printfd
x ;
i i ;
x x ;
answer x;
without high level language such as for loops and if statements.
Heres my code
program DivisibleBySix;
#includestdlibhhf
static
x: int; User input value
i: int :; Loop counter for six values
current: int; Current value being checked
remainder: int; Remainder when dividing by
begin DivisibleBySix;
Prompt the user for input
stdout.putFeed me: ;
stdin.getx;
Initialize the current value to the user input
current : x;
Loop to find and print the next six values divisible by
whilei do
Check if the current value is divisible by
remainder : current mod ;
ifremainder then
If divisible by print the value
stdout.putcurrent nl;
Increment the counter for found values
i : i ;
endif;
Increment the current value to check the next one
current : current ;
endwhile;
end DivisibleBySix;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
