Ten integer numbers are entered from the keyboard into an array named nums. Write a program...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Ten integer numbers are entered from the keyboard into an array named nums. Write a program to print the array elements and find out how many of them are positive, how many are negative, how many are even and how many odd. A sample output is shown below: Numbers are: 9, 6, 17, 11, 12, 18, -9, -3, -3, 6, #positive numbers = 5 negative numbers = 5 #odd numbers = 6 #even numbers = 4 Part B: C Programming Exercise (10 marks) Rewrite Part A by generating 20 random numbers between -20 and 20 and defining four functions of countPositives, countNegatives, countOdds and countEvens. Each function has 2 input parameters; an array of numbers and size of the array and returns an integer. Ten integer numbers are entered from the keyboard into an array named nums. Write a program to print the array elements and find out how many of them are positive, how many are negative, how many are even and how many odd. A sample output is shown below: Numbers are: 9, 6, 17, 11, 12, 18, -9, -3, -3, 6, #positive numbers = 5 negative numbers = 5 #odd numbers = 6 #even numbers = 4 Part B: C Programming Exercise (10 marks) Rewrite Part A by generating 20 random numbers between -20 and 20 and defining four functions of countPositives, countNegatives, countOdds and countEvens. Each function has 2 input parameters; an array of numbers and size of the array and returns an integer.
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
Q1. You have identified a market opportunity for home media players that would cater for older members of the population. Many older people have difficulty in understanding the operating principles...
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
In an effort to check the quality of their cell phones, a manufacturing manager decides to take a random sample of 10 cell phones from yesterdays production run, which produced cell phones with...
-
Amicus Therapeutics, Inc., is a biopharmaceutical company that develops drugs for the treatment of various diseases, including Parkinson's disease. Amicus Therapeutics reported the following...
-
29. A distance of 345.75 ft is measured by a survey crew. The true distance is known to be 345.82 ft. What is the relative accuracy of the measurement?
-
Which of the following statements is false? a. RMSE and MAE often agree on which regression model is the most accurate. b. RMSE and MAE both indicate when the predicted values are consistently larger...
-
Klein and Sachs, CPAs, budgeted for the following professional labor hours for the coming year: partners, 4,000; managers, 10,000; and staff, 25,000. Budgeted billing rates are: partners, $250 per...
-
Discuss some of the myths associated with teen pregnancy? Why are these myths incorrect and what harm can they do? How can we as workers in the fieldwork to help change these perceptions?
-
2.1 The data in the table below was collected by sampling the contents of a batch reactor with time, where A is reacting. Assume that the volume of the sample removed is negligible compared to the...
-
Why is the range value affected by outliers?
-
What are the ethical issues involved in sampling?
-
Why is it important to be able to use different closing methods in different situations?
-
You are the global sales manager for Samsung responsible for sales of their tablet computers. The company has just announced a new model that will be available in five countries starting next month...
-
Identify the five objectives of a sales presentation and develop an example of how a sales presentation would accomplish each one.
-
At the beginning of the 21st century, as businesses prepared for Y2K, companies were implementing a new computer system which was Enterprise Resource Planning (ERP). The company where you work wants...
-
Annual dividends of ATTA Corp grew from $0.96 in 2005 to $1.76 in 2017. What was the annual growth rate?
-
Fill in the blanks in each of the following statements: a) The _________namespace contains the BinaryFormatter class. b) StreamReader method _________reads a line of text from a file. c) StreamWriter...
-
Fill in the blanks in each of the following statements: a) If a class contains at least one abstract method, it must be declared as a(n) _______class. b) Classes from which objects can be...
-
Write C# statements to accomplish each of the following tasks: a) Display the value of the element of character array f with index 6. b) Initialize each of the five elements of one-dimensional...
-
On May 8, 1984, Hannah Motsi graduated from Louisiana State University. She set to work opening a coffee shop in Baton Rouge called HannaH and found a perfect location in a new development. Using a...
-
How does the firms WACC (with taxes) change with leverage?
-
Assume that Microsoft has no debt, a total market value of $2 trillion, and a marginal tax rate of 21%. If it permanently changes its leverage from no debt by taking on new debt in the amount of 13%...
Study smarter with the SolutionInn App