namespace ConsoleApplication1 class Program static void ChangeName int

 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
43
namespace ConsoleApplication1 {
class Program {
static void ChangeName(int[] Name) {
for (int i = 0; i < Name.Length; i++) {
foreach (int el in Name) {
Name[i]= 7;
}
}
}
static int SumVal(int[] array) {
int sum=0;
for (int i = 0; i < array.Length; i++) {
sum += array[i];
}
return sum;
}
static int MiddleSum(int[] arr) {
int msum=0;
for (int i = 0; i < arr.Length; i++) {
msum += arr[i] / arr.Length;
}
return msum;
}
static void Main(string[] args) {
int[] Names = { 1,2,3,4,5,6,7};
ChangeName(Names);
for (int t = 0; t < Names.Length; t++) {
Console.WriteLine(Names[t]);
}
int sum = SumVal(Names);
Console.WriteLine(sum);
int msum = MiddleSum(Names);
Console.WriteLine(msum);
Console.ReadKey();
}
}
}