write a program that takes two comma separated lists of Integers as an input. For each integer N in the first list, the program needs to find the counts of its occurrence called C called in second list. The program should print the N-C for each integer.
Answers
Answer:
Written in c#
Explanation:
class Program
{
static void Main(string[] args)
{
string list1, list2;
list1 = Console.ReadLine().ToString();
list2 = Console.ReadLine().ToString();
string[] array1 = list1.Split(',');
string[] array2 = list2.Split(',');
for (int i = 0; i < array1.Length; i++)
{
string value = array1[i];
int count = 0;
for (int j = 0; j < array2.Length; j++)
{
if (value == array2[j])
{
count++;
}
}
Console.WriteLine(value + "-" + count);
}
}
}
Answer:
lst = list(map(int, input().split(",")))
lst2=list(map(int, input().split(",")))
for n in lst:
c=0
for n2 in lst2:
if(n==n2):
c=c+1
print(n,"-",c);
Explanation:
This program is written in python language.
Python is a high-level programming language Designed by Guido van Rossum.
Python is mainly used for website building.
This program takes two comma separated lists of Integers as an input. For each integer N in the first list, the program finds the counts of its occurrence called C called in second list. The program print the N-C for each integer.
The output of the given program is attached to this question in the given image.
To read more programs in python language on brainly.in :
https://brainly.in/question/50171227
https://brainly.in/question/49222417