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
Elenna [48]
4 years ago
10

Write a C++ program that takes as input a list ( an array) of n integrers and finds the number of negative inetgers inthe list (

array ).
Side Note: The problem did not come out ofthis book but the information that I study is from this book. And Iam not getting how to write the program.
Computers and Technology
1 answer:
telo118 [61]4 years ago
6 0

Answer:Following is the program for the count of negative integers in an array:-

#include <bits/stdc++.h>  

using namespace std;

int main()

{

   int n,count=0;//declaring 2 variables n and count and initializing count with 0..

   cout<<"Enter the size of the array"<<endl;

   cin>>n;//prompting the size of the array...

   int negative_nums[n];//array of integers of size n..

   cout<<"Enter the numbers"<<endl;

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

   cin>>negative_nums[i];//prompting elements of the array...

   for(int i=0;i<n;i++)//iterating over the array....

   {

       if(negative_nums[i]<0)// if integer in the array at ith position is negative...  

       count++;// increasing the count...

   }

   cout<<"The number of negative numbers are "<<count<<endl;//printing the count of negative integers...

   return 0;

}

Explanation:

1. In the program i have taken a count integer initializing it with 0

2. Iterating over the array.

3. If the element at ith position is less than zero then increasing the count by 1.

4.Printing the count of negative integers in the array.

You might be interested in
Write the program to solve quadratic equations, but if the discriminant is negative, output
Firdavs [7]

Answer:

PROGRAM  QuadraticEquation Solver

  IMPLICIT  NONE

REAL :: a, b, c ;

  REA :: d ;

  REAL  :: root1, root2 ;

//read in the coefficients a, b and c

  READ(*,*)    a, b, c  

  WRITE(*,*)   'a = ', a

  WRITE(*,*)   'b = ', b

  WRITE(*,*)    'c = ', c

  WRITE(*,*)

// computing the square root of discriminant d

  d = b*b - 4.0*a*c

  IF (d >= 0.0) THEN              //checking if it is solvable?

     d     = SQRT(d)

     root1 = (-b + d)/(2.0*a)     // first root

     root2 = (-b - d)/(2.0*a)     // second root

     WRITE(*,*)  'Roots are ', root1, ' and ', root2

  ELSE                            //complex roots

     WRITE(*,*)  'There is no real roots!'

     WRITE(*,*)  'Discriminant = ', d

  END IF

END PROGRAM  QuadraticEquationSolver

8 0
4 years ago
Give the value of the zero flag, the carry flag, the signflag, and the overflow flag after each of the following instructions if
Vanyuwa [196]
The correct answer is A for this question
6 0
2 years ago
Which is true about POP3 and IMAP for incoming email?
Novay_Z [31]

Answer:

Both keep email on an email server by default

Explanation:

IMAP synchronises emails, while POP3 downloads them for offline use.

7 0
3 years ago
Information systems that support the sales process of B2C companies are typically Web storefronts that customers use to enter an
RoseWind [281]

Answer:

This statement is CORRECT in electronic commerce and Online stores

Explanation:

The term B2C is derived from e-commerce which means Business to Consumer which describes  the process of selling goods and services directly to consumers who are the end-users. The advent of the dot com web boom led to a huge increase in these kinds of companies that sell directly to consumers through their online (website) channels.

3 0
3 years ago
How precisely can you rotate a graphic in a document?
Cloud [144]
Any picture of what our talking about
4 0
3 years ago
Other questions:
  • If you like to interact with the game’s environment rather than with its inhabitants, which Bartle player type would you conform
    12·2 answers
  • An operating system cannot run from an external drive. true or false
    15·1 answer
  • A website updated daily could be considered _____. a. authoritative b. objective c. accurate d. timely
    8·1 answer
  • What are two ways to access the options for scaling and page orientation? click the home tab, then click alignment, or click the
    10·1 answer
  • 5. RAM IS YOUR SYSTEM’S-
    14·2 answers
  • Which of the following are documents that can help you to review and assess your organization’s status and state of security? Fi
    6·1 answer
  • What determines how a system will work to meet the business needs defined during system investigation?
    13·1 answer
  • What is the output of the following code:
    12·1 answer
  • How do you believe cryptocurrency work shape the next 10 years
    6·1 answer
  • If you are inviting more than one person to a meeting, you can use a(n) _____ to separate the email addresses.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!