-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
42 lines (40 loc) · 1.45 KB
/
Copy pathProgram.cs
File metadata and controls
42 lines (40 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
class Program
{
static void Main()
{
int m, n, x = 0;
Console.WriteLine("Введите кол-во элементов 1 массива: ");
m = int.Parse(Console.ReadLine());
int[]m1 = new int[m];
Console.WriteLine("Поочереди введите элементы в 1 массив: ");
for (int i = 0; i < m; i++)
{
m1[i] = int.Parse(Console.ReadLine());
}
Console.WriteLine("Введите кол-во элементов 2 массива: ");
n = int.Parse(Console.ReadLine());
int[] m2 = new int[n];
Console.WriteLine("Поочереди введите элементы во 2 массив: ");
for (int i = 0; i < n; i++)
{
m2[i] = int.Parse(Console.ReadLine());
}
int[] m3 = new int[m + n];
for (int i = 0; i < m; i++)
{
m3[i] = m1[i];
}
for (int i = m; x < n; x++)
{
m3[i] = m2[x];
i++;
}
Console.WriteLine("Элементы суммарного массива: ");
for (int l = 0; l < (m + n); l++)
{
Console.Write(m3[l] + " ");
}
Console.ReadLine();
}
}