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

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

Computers and Technology
1 answer:
levacccp [35]3 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
What function(s) does an interpreter perform with the instructions in a high-level programming language?
allochka39001 [22]

Answer:

Translates and Executes.

Explanation:

5 0
3 years ago
Suppose you are an ad-serving company and you maintain a log of cookie data for ads you serve to the Web pages for a particular
Firlakuza [10]

Answer:

A

Explanation:

thethe more you have attached the more people are going to know your product so that it's going to be a long process which people can introduce to their friends

3 0
2 years ago
The four smallest numbers (40 points) Write an ANNA assembly program (smallest_four.ac) that finds the four smallest numbers ent
kari74 [83]

Answer:

the answer is -25

Explanation:

6 0
2 years ago
Which of the following questions will most likely be answered by displaying data on a line graph?
Neko [114]
It would be A because B could be answered best with a poll graph, C with a pie graph, and D with a bar graph. Line graphs typically show speed and rate so A makes the most sense, but you are still able to do the other questions on a line graph.
4 0
3 years ago
Consider the following class interfaces:
o-na [289]

Answer:

class teacher and student I didn't actually read it but I think it is class student

6 0
3 years ago
Other questions:
  • What's a qat on a computer
    12·2 answers
  • Write a program that inputs a line of text and uses a stack object to print the line reversed.
    14·1 answer
  • Book checkout scenario at a library: The Worker tells the System the identity of a patron who wishes to check out books. The Sys
    8·1 answer
  • Implement the function:
    6·1 answer
  • What is the other name of the horizontal column graph
    9·1 answer
  • Hewo everyone look at me I look ugly don't I<br>​
    6·2 answers
  • Write a program that takes paragraph from the user and prints all unique words in that paragraph using strings in c++
    5·1 answer
  • I like to troll what about you
    10·1 answer
  • Karin realized that a song takes up a lot more space on her computer than the lyrics of the song typed out in ms word document .
    12·1 answer
  • What is computer specification
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!