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
BigorU [14]
4 years ago
7

Implement a function called merge that does the following in C#:

Computers and Technology
1 answer:
levacccp [35]4 years ago
8 0

Answer:

Check the explanation

Explanation:

using System;

using System.Collections.Generic;

using System.Linq;

public class Problem2

{

public static IEnumerable<int> merge (IEnumerable<int> input1, IEnumerable<int> input2, IEnumerable<int> input3)

{

IList<int> list = new List<int>();

foreach (int i in input1)

{

if(i%3==0 && ! list.Contains(i))

list.Add(i);

}

foreach (int i in input2)

{

if(i%3==0 && ! list.Contains(i))

list.Add(i);

}

foreach (int i in input3)

{

if(i%3==0 && ! list.Contains(i))

list.Add(i);

}

return list;

}

}

public class Problem2Demo{

static void Main (string[] args)

{

Random rnd = new Random ();

var list1 = Enumerable.Range (1, 10).Select (i => (rnd.Next () % 15) + 1);

var list2 = Enumerable.Range (1, 10).Select (i => (rnd.Next () % 15) + 1);

var list3 = Enumerable.Range (1, 10).Select (i => (rnd.Next () % 15) + 1);

var answer = Problem2.merge (list1, list2, list3);

foreach (int i in answer)

{

Console.WriteLine (i);

}

}

Kindly check the attached output image below.

You might be interested in
Which of the following is not a reason to choose a community college?
k0ka [10]
They do not make as big of a impression than a famous university when applying for jobs.
8 0
2 years ago
Create a float variable named diameter. This variable will hold the diameter of a circle. d. Create a float variable named PI.
Basile [38]

Answer:

float diameter=2*r; //hold the diameter of a circle

float PI; // float variable named PI.

Explanation:

Here we have declared two variable i.e diameter and PI of type float. The variable diameter will hold the diameter of a circle i.e  2*r  where r is the radius of a circle.

Following are the program in c++

#include <iostream> // header file

using namespace std; // namespace

int main() // main function

{

   float r=9.2; // variable declaration

float diameter=2*r; //hold the diameter of a circle

float PI=3.14; // float variable named PI hold 3.14

cout<<"diameter IS :"<<diameter<<endl<<"PI IS :"<<PI; // display value

  return 0;

}

Output:

diameter IS :18.4

PI IS :3.14

8 0
3 years ago
Companies use virtualization to do all of the following except:
dangina [55]

Answer:

c)

Explanation:

Virtualization refers to running a virtual instance of a computer system apart from the actual software. Companies use this virtualization to do all of the following except Reduce the amount of applications in corporate datacenters. Instead few systems have the applications and those systems are cloned through virtualization.

4 0
3 years ago
Which theorist studied the power elite and the influence they had over society?
Pavel [41]
The correct answer is <span>C. Wright Mills
He was a rather famous sociologist from the 20th century who also worked as a professor at Columbia university. He was a leftist and one of his famous books "The Power Elite" was crucial in describing class relations in the US between the elites and the regular people.</span>
6 0
3 years ago
How can you use the Address Book to address an email message? Use the drop-down menus to complete the sentences. 1. Type an emai
Delvig [45]

Answer:

1. AutoCorrect

2. Address book

Explanation:

stan bts ?

5 0
3 years ago
Read 2 more answers
Other questions:
  • How does a Computer chip work?
    6·2 answers
  • When people take a image on their phone how can they copy the image into google docs.
    6·2 answers
  • An organization has a datacenter that processes highly sensitive information and is staffed 24 hours a day. The datacenter inclu
    12·1 answer
  • To add a slide using the default layout, what should you do before clicking the New Slide button?
    15·1 answer
  • What is the purpose of indexing?
    15·2 answers
  • Which of the following is needed to connect to the Internet? HELP ASAP
    9·1 answer
  • While organizing his computer's power cords, Matt realizes his printer power cord is frayed (coming apart). What should Matt do
    10·1 answer
  • Which gases are carried by red blood cells? Select two options.<br> science question
    14·2 answers
  • After inserting a video into your slide how can you test it
    11·1 answer
  • 7 TH GRADE QUESTION...PLS HELP
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!