Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write this in LC-3 Assembly code!!!!!!(very important!!!) And write it in every step so that it works as given in the question. Description In

Please write this in LC-3 Assembly code!!!!!!(very important!!!) And write it in every step so that it works as given in the question.

image text in transcribed

image text in transcribed

Description In this week's assignment, you will write a program that prints the prime numbers in a given range. A prime number is a natural number (positive integer) that is only divisible by itself and 1. here are various ways to check whether a number is a prime number, with various levels of efficiency, and to pass all test cases you need to implement an efficient prime checker. Note: you do not need to implement the Sieve of Eratosthenes; efficiently eliminating a large section of the search space is enough. Input The input for this assignment consists of two natural numbers a and b such that 2a,b20000 which denote the range [a,b]]. a and b are separated by a single space and followed by a new line character. Note that the range can also be decreasing instead of increasing. An example of this is a=5 and b=1. Output First, you should print numbers a and b followed by a new line character. Next, for any number x in the range [a,b] there are two options: 1) x is a prime number. In this case, you should print x is a prime number, where x denotes the value of x 2) x is not a prime number. In this case, you should print x is not a prime number as it is divisible by y, where x denotes the value of x and y denotes the value of the smallest divisor of x. Note that if the range is decreasing (e.g. a=5,b=1 ) you should also print your results in decreasing order of x. 52 5 is a prime number 4 is not a prime number as it is divisible by 2 3 is a prime number 2 is a prime number

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

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions