Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Ten integer numbers are entered from the keyboard into an array named nums. Write a program to print the array elements and find out

   

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.

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

Visual C# How to Program

Authors: Paul J. Deitel, Harvey Deitel

6th edition

134601548, 134601793, 978-0134601540

More Books

Students also viewed these Programming questions