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
solong [7]
3 years ago
9

Write a function that receives an integer list from STL and returns the sum of even numbers in the list (return zero if no even

number is in the list)
Computers and Technology
1 answer:
Doss [256]3 years ago
8 0

Answer:

int sumeven(int lis[],int n)

{

   int sum_e=0;//integer variable to store the sum.

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

       {

           if(lis[i]%2 == 0)//if the number is even adding to sum_e.

           sum_e=sum_e+i;

       }

   return sum_e;//retuning the sum.

   

}

Explanation:

The above written function is in C++.This function find the sum of even numbers in the list provided.It loops over the array and if the number is even adds to the variable sum_e finally return sum_e which having the sum of even numbers now.

You might be interested in
A certain list, L, contains a total of n numbers, not necessarily distinct, that are arranged in increasing order. If L1 is the
Free_Kalibri [48]

In this question, we are given ,

  • A certain list, L, contains a total of n numbers, not necessarily distinct, that are arranged in increasing order.
  • L1 is the list consisting of the first n1 numbers in L.
  • L2 is the list consisting of the last n2 numbers in L.

Explanation:

As per the information given in statement 1, 17 is a mode for L1 and 17 is a mode for L2.

Therefore, we can infer that ,

  • 17 must occur in L1, either same or a greater number of times as any other number in L1.
  • 17 must occur in L1, either same or a greater number of times as any other number in L2.

As all elements in L are in ascending order, we can also conclude that

  • Each number between last occurrence of 17 in L1 and the first occurrence of 17 in L2 must be equal to 17 only.
  • Therefore, 17 occurs either same or greater number of times as any other number in L.
  • Thus, 17 is a mode for L.

However, from this statement, we cannot conclude anything about the mode of L1, L2, or L.

Hence, statement 2 is not sufficient to answer the question.

Therefore, 17 is a mode for L1 and 17 is a mode for L2.

3 0
3 years ago
This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by
stira [4]

Answer:

Here is the C program:

#include <stdio.h>  //to use input output functions

int main(void) {   //start of main function

 int arrowBaseHeight = 0;  //stores value for arrow base height

int  arrowBaseWidth = 0;  //stores value for arrow base width

 int arrowHeadWidth = 0 ;  //stores value for arrow head width

 int i, j;  //to traverse through the rows and columns

 printf("Enter arrow base height:\n");  //prompts user to enter arrow base height value

 scanf("%d", &arrowBaseHeight);  //reads input value of arrow base height

 printf("Enter arrow base width:\n");  //prompts user to enter arrow base width value

 scanf("%d", &arrowBaseWidth);  //reads input value of arrow base width

 while (arrowHeadWidth <= arrowBaseWidth)  {   //iterates as long as the value of arrowHeadWidth is less than or equals to the value of arrowBaseWidth  

     printf("Enter arrow head width:\n");   //prompts user to enter arrow head width value

     scanf("%d", &arrowHeadWidth);   //reads input value of arrow head width

     printf("\n"); }

 for (i = 0; i < arrowBaseHeight; i++)    {   //iterates through rows

     for (j = 0; j < arrowBaseWidth; j++)  {   //iterates through columns

         printf("*");       }   //prints asterisks

     printf("\n");   }   //prints a new line

 for (i = arrowHeadWidth; i > 0; i--)    {   //loop for input length

     for (j = i; j > 0; j--)        {   //iterates for triangle ( to make arrow head)

         printf("*");       }   //prints asterisks

     printf("\n");   }  } //prints new line

Explanation:

The program asks to enter the height of the arrow base, width of the arrow base and the width of arrow head. When asking to enter the width of the arrow head, a condition is checked that the arrow head width arrowHeadWidth should be less than or equal to width of arrow base arrowBaseWidth. The while loop keeps iterating until the user enters the arrow head width larger than the value of arrow base width.  

The loop is used to output an arrow base of height arrowBaseHeight.

The nested loop is being used which as a whole outputs an arrow base of width arrowBaseWidth. The inner loop draws the stars and forms the base width of the arrow, and the outer loop iterates a number of times equal to the height of the arrow.

The last nested loop is used to output an arrow head of width arrowHeadWidth. The inner loop forms the arrow head and prints the stars needed to form an arrow head.  

The screenshot of output is attached.

8 0
3 years ago
What is the purpose of external firewalls? to prevent users from accessing sensitive human resource or financial data to limit a
ziro4ka [17]
<span>keep out unauthorized internet users from intranet networks

All firewalls are used to control the traffic between networks to only allowed traffic.
</span>
3 0
3 years ago
The legal concept of limited use permits limited duplication and use of a portion of copyrighted material for certain purposes,
kirza4 [7]

Answer:

Fair Use

Explanation:

In the United States’ copyright law, fair use means the use of a document that is copyrighted within a limited scope. Generally, before one can use a copyrighted document, permission must be sought and obtained from the copyright holder. But for usages such as the ones mention in the question otherwise referred to as "transformative", an individual can make use of a copyrighted material without first seeking permission.

5 0
3 years ago
Which of the following is considered the necessary research done before launching a scan?
wolverine [178]

Answer:

A. Network Reconnaissance.

Explanation:

Network Reconnaissance is a process of testing for vulnerability in a network. It could be a legitimate testing by a network operator to protect the network, setting acceptable user policies or a attacker finding a way to the network. In this process, intrusion detection mostly gives alarm on every reconnaissance activities.

To launch a scan in a network, an operator must have in mind to either carry out a reconnaissance activity or scan for network Reconnaissance attacks.

6 0
4 years ago
Other questions:
  • What does the Autosum feature on excel do?
    15·1 answer
  • Is the conversation recorded when the party answers or when they dial the number?
    7·1 answer
  • Write a program that computes the monthly net pay of the employee for a steel factory. The input for this program is the hourly
    10·1 answer
  • Input is information a system uses to monitor and adjust itself to meet the goal.
    8·1 answer
  • What is the Microsoft excel window where you work on. And it composed of three worksheet?​
    7·1 answer
  • E Highlight
    6·1 answer
  • I had about 83 GB before I installed Xcode, I was in the middle of the installation and reconsidered my decision but it's still
    7·2 answers
  • Susan is a network administrator and is setting up her company's network. In the process to determine an open port on a firewall
    11·1 answer
  • Question 5 of 10
    10·1 answer
  • Which program controls the windows startup sequence
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!