using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ARRAy
{classProgram{staticvoidMain(string[] args){int max =0;//输入整型数组string Array = Console.ReadLine();//读取数组元素string[] Splitted = Array.Split(' ');//将字符串的空格分隔劈开int[] a =newint[Splitted.Length];//用.Length获取数组大小for(int i =0; i < Splitted.Length; i++)//导入到新建的整型数组中 {
a[i]=int.Parse(Splitted[i]);}//获得数组a[0]和a[1]中较大数,与下个数据比较,重复该步骤,直至获得最大的数if(a[0]< a[1])
max =1;else
max =0;for(int i =2; i < Splitted.Length; i++){if(a[max]< a[i]){
max = i;}}
Console.WriteLine("最大值下标为:"+max );
Console.WriteLine("最大值为:"+a[max]);
Console.Read();}}}