3. Write a C program to find prime numbers located inside an array. Use the given...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
3. Write a C program to find prime numbers located inside an array. Use the given function to decide whether a number is prime or not. Display a number list to indicate number status. (Assume that the numbers are between 1 and 100 and use the following array data). int data[] = {28,81,13,31,54,7, 31, 19, 23, 40, 39, 36, 15, 69, 50, 41, 33,3,5,8)}; int isPrime(int number) { int i; int halfNumber = number / 2; if ((number % 2) == 0) { return 0; } for (i = 3; i < halfNumber; i+=2) { } } if ((number % i) == 0) { return 0; } return 1; 3. Write a C program to find prime numbers located inside an array. Use the given function to decide whether a number is prime or not. Display a number list to indicate number status. (Assume that the numbers are between 1 and 100 and use the following array data). int data[] = {28,81,13,31,54,7, 31, 19, 23, 40, 39, 36, 15, 69, 50, 41, 33,3,5,8)}; int isPrime(int number) { int i; int halfNumber = number / 2; if ((number % 2) == 0) { return 0; } for (i = 3; i < halfNumber; i+=2) { } } if ((number % i) == 0) { return 0; } return 1;
Expert Answer:
Answer rating: 100% (QA)
The image you provided presents a question which asks to write a C progra... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Management accounting is mostly concerned with the provision of information to enable managers to perform their tasks. In order to achieve the best performance, it is crucial for managers to obtain...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
In Exercises 8486, use a graphing utility to graph f and g in the same [-8, 8, 1] by [-5, 5, 1] viewing rectangle. In addition, graph the line y = x and visually determine if f and g are inverses....
-
Selected data derived from the income statement and balance sheet of National Beverage Co. for a recent year are as follows: Income statement data (in thousands): Net earnings (loss)...
-
The loop moves at a constant 10 cm/s. Plot a graph of the current in the loop as a function of time. Label the axes with numerical values and take counterclockwise current to be positive. In Fig....
-
The account balances of Tompkins Towing Service, Inc., at June 30, 2012, follow: Requirements 1. Prepare the balance sheet of the business at June 30, 2012. 2. What does the balance sheet...
-
Charitable Contributions and Debt: A Comparison of St. Jude Childrens Research Hospital/ALSAC and Universal Health Services located in Ch. 5 of Mastery of the Financial Accounting Research System...
-
Question 4 Question 4a, b, c and d are mutually exclusive and independent of each other. Answer each part according to the given scenario. Question 4a Kiwi Pte Ltd (KPL) acquired the trademark of a...
-
In 1738, J. Bernoulli investigated the St. Petersburg paradox, which works as follows. You have the opportunity to play a game in which a fair coin is tossed repeatedly until it conies up heads. If...
-
Consider how communication could be improved within one organization (any organization) & explain how that communication could be improved in order to make that organization more successful (i.e....
-
Discuss at least one source of power that could be applied to influence the department and improve organizational performance.
-
Discuss the concept of distributed leadership and its implications for fostering decentralized decision-making structures that promote agility and adaptability in dynamic environments .
-
Briefly describe the process of incorporation. Be sure to note which amendment was used to begin the process of incorporation and why the Supreme Court decided to implement this process.
-
Discuss how the organization connected its selected directional strategies and strategic alternatives to its mission, vision, and values. Provide examples from the case study. Evaluate the...
-
For each the following fallacies, find at least one advertisement that is an instance of it: Appeal to Authority False Dilemma Irrelevant Reason Equivocation Appeal to Popularity Appeal to Tradition...
-
The vapour pressure of pure liquid solvent A is 0.80 atm. When a nonvolatile substance B is added to the solvent its vapour pressure drops to 0.60 atm. What is the mole fraction of component B in the...
-
Assume that your audit team has established the following parameters for the examination of ELM's sales transactions: LO G-3 Risk of incorrect acceptance...
-
Go to Chapter 1 Extra Help on the Web site and click on LearnChemE ScreenCasts (http://www.umich.edu/~elements/6e/01chap/learn-chemevideos.html). Choose one of the LearnChemE videos and critique it...
-
Go to the Web site (http://www.umich.edu/~elements/6e/12chap/iclicker_ch12_q1.html) and view five i>clicker questions. Choose one that could be used as is, or a variation thereof, to be included on...
-
The initial reaction rate for the elementary reaction 2A + B 4C was measured as a function of temperature when the concentration of A was 2 M and that of B was 1.5 M. a. What is the activation...
-
Assume WestJet repaired one of its Boeing 737 aircraft at a cost of \(\$ 0.8\) million, which West Jet paid in cash. Further, assume that the WestJet accountant erroneously capitalized this cost as...
-
Assume that at the beginning of 2020, Porter Airlines purchased a Bombardier Q400 aircraft at a cost of \(\$ 25,000,000\). Porter expects the plane to remain useful for five years \((5,000,000...
-
Assume that on September 30, 2020, Swiss, the national airline of Switzerland, purchased an Airbus aircraft at a cost of \( 40,000,000\) ( \(\) is the symbol for the euro). Swiss expects the plane to...
Study smarter with the SolutionInn App