1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kumpel [21]
3 years ago
14

) Consider the array called myArray declared below that contains and negative integers. Write number of positive integers in the

array. That is, your loop display the message "Number of positive integers is 5" a loop statement to count and display the should (4 points) int myArray[]卟1,3,-9,9,33,-4,-5, 100,4,-23); Note: The loop should always work without modification even if the values in th array are changed
Computers and Technology
1 answer:
grigory [225]2 years ago
6 0

Answer:

#include <iostream>

using namespace std;

int main()

{

 

  int arr[]={3,-9,9,33,-4,-5, 100,4,-23};

  int pos;

  int n=sizeof(arr)/sizeof(arr[0]);

  for(int i=0;i<n;i++){

      if(arr[i]>=0){

          pos++;

      }

  }

  cout<<"Number of positive integers is "<<pos<<endl;

  return 0;

}

Explanation:

create the main function in the c++ programming and declare the array with the element. Then, store the size of array by using the formula:

int n=sizeof(arr)/sizeof(arr[0]);

after that, take a for loop for traversing the array and then check condition for positive element using if statement,

condition is array element greater than or equal to zero.

if condition true then increment the count by 1.

this process happen until the condition true

and finally print the count.

You might be interested in
Which statement best justifies the use of a high-speed cache in a CPU?
crimeas [40]

Cache memory is a high-speed memory that stores the instructions and data that have been frequently accessed.  It decreases the time it takes to decode the instructions stored in the instruction pipeline.

A.  It decreases the time it takes to decode instructions stored in the instruction pipeline.

<u>Explanation:</u>

Whenever an instruction is invoked or some data is accessed, the CPU looks for it in the cache memory before accessing the main memory.

If the content is found in the cache memory, it accessed from there and then and hence the access time and decode time is reduced as there were no main memory lockups.

6 0
3 years ago
(word excel)
Aloiza [94]
D is the answer to that problem
7 0
2 years ago
Which tab provides commands for the most commonly used elements in Word Software?
Flauer [41]
I think it should be in the design tab
6 0
2 years ago
The probability that the price of a commodity is increasing is 0.62 and the probability that the price is decreasing is 0.18 . W
liraira [26]

bahug ka itlog hduxuwlowv heusuowjdd

8 0
2 years ago
Mark’s friends told him about an automated program that sends unsolicited messages to multiple users. Which type of program were
Phantasy [73]
Spambots send thousands of messages world wide once they get your information things like email and such and send out unsolicited things out constantly. Brainliest??
5 0
3 years ago
Read 2 more answers
Other questions:
  • Using a database of precomputed hashes from sequentially calculated passwords called a(n) __________, an attacker can simply loo
    14·1 answer
  • What are the main types of computer software?
    5·2 answers
  • The______for our newest game keeps changing as we develop our concept and refine our goals.
    11·2 answers
  • What keyboard command opens the Go To dialog box?
    11·2 answers
  • Match letters from column B to Column A by looking at the picture above.
    11·1 answer
  • What do you think is the most fascinating aspect of the internet?
    7·2 answers
  • I'm making a game. I'm trying to make it so that instead of how I currently have it, starting whenever I click the screen, it st
    6·1 answer
  • In Subtractive empathy, the counselor responses gives back less (or distorts) than what the client has said. slightly add someth
    14·1 answer
  • This is for C++: Using a nested for loop output the following pattern to the screen:
    12·1 answer
  • How did Matt Pyke and Karsten Schmidt create the advertisement for Audi? Multiple choice question. Filmed the car as wind tossed
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!