Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write it as a modular program Exercise 1 [30 Marks]| We would like to write a computer program that asks the user to enter

Please write it as a modular program

image text in transcribed
Exercise 1 [30 Marks]| We would like to write a computer program that asks the user to enter an integer number N, such that N > 0, and prints: -all the prime numbers between 0 and N, and -the total number of prime numbers between 0 and N, and -the sum of these prime numbers. -The average of these numbers. For example, if N == 15, then your program should output: The prime numbers between 0 and 15 and they ares 2y 3 Hi Iy 1ly 13w There are in total 6 prime numbers between 0 and 15. Their sum is 41. Their average is 6.83. An integer number X is said to be a prime number if and only if it is divisible only by 1 and itself. For example: -2 1s a prime number because it is only divisible by 1 and 2. -13 is a prime number because it is only divisible by 1 and 13. -15 is not a prime number because it is divisible by 1, 3, 5 and 15. -1 1s not a prime number because it 1s divisible by itself only (some may argue against this, but this is the widely adopted convention!). ) Write the algorithm that solves the problem above [12 Marks]. Write the corresponding C program [15 Marks]. o Testing [3 Marks]: Using the table below provide a set of test data with the expected results, and the results produced by your program (add rows to the table as needed). Important notes: -You must provide screenshots of your program running and produce the results for each of the test cases. -You are not allowed to use a pre-built function that finds prime numbers or checks whether a number is a prime number. You must design and implement your own function(s). Test Test description/justification Actual Expected Actual Program test id what is the test for and why data for output program outcome this particular test this test output when Pass/Fail test is carried out LN

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

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions

Question

Regulation of normal activities of the human heart take place?

Answered: 1 week ago