Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApplication
- {
- class Class
- {
- static int [] Input ()
- {
- Console.WriteLine("введите размерность массива");
- int n=int.Parse(Console.ReadLine());
- int []a=new int[n];
- for (int i = 0; i < n; ++i)
- {
- Console.Write("a[{0}]= ", i);
- a[i]=int.Parse(Console.ReadLine());
- }
- return a;
- }
- static int Max(int[] a)
- {
- int max=a[0];
- for (int i = 1; i < a.Length; ++i)
- if (Math.Abs(a[i]) > max) max=a[i];
- return max;
- }
- static void Main()
- {
- int[] myArray=Input();
- int max=Max(myArray);
- for (int i=0; i<myArray.Length;++i)
- Console.WriteLine(max);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement