By dividing the number n by each number from 2..n/2 in an inner loop, create a programme that finds prime numbers from 3 to n in a loop. Find the smallest number that divides n using the remainder (rem) operation. Leave the inner loop if n is divisible. If the inner loop is still running after reaching the n/2 limit, the integer is prime, and you should output it. In this case, your programme would print out "2, 3, 5, 7, 11, 13, 17, 19, 23" if the user entered 25. code in assembly language
By dividing the number n by each number from 2..n/2 in an inner loop, create a programme that finds prime numbers from 3 to n in a loop. Find the smallest number that divides n using the remainder (rem) operation. Leave the inner loop if n is divisible. If the inner loop is still running after reaching the n/2 limit, the integer is prime, and you should output it. In this case, your programme would print out "2, 3, 5, 7, 11, 13, 17, 19, 23" if the user entered 25. code in assembly language
C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.3: Interactive While Loops
Problem 5E
Related questions
Question
By dividing the number n by each number from 2..n/2 in an inner loop, create a programme that finds prime numbers from 3 to n in a loop. Find the smallest number that divides n using the remainder (rem) operation. Leave the inner loop if n is divisible. If the inner loop is still running after reaching the n/2 limit, the integer is prime, and you should output it. In this case, your programme would print out "2, 3, 5, 7, 11, 13, 17, 19, 23" if the user entered 25.
code in assembly language:
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning