int[] age = new int[4];//声明并初始化长度为4的整形数组
//为数组元素赋值
age[0] = 18;
age[1] = 20;
age[2] = 23;
age[3] = 17;
Console.WriteLine("四名同学的年龄是:{0}、{1}、{2}、{3}",
age[0],age[1],age[2],age[3]);
//为数组元素赋值
age[0] = 18;
age[1] = 20;
age[2] = 23;
age[3] = 17;
Console.WriteLine("四名同学的年龄是:{0}、{1}、{2}、{3}",
age[0],age[1],age[2],age[3]);
2018-05-08
char sex='男';//性别 int age = 21;//年龄 char sex1='女'; int age1 = 20; if(age>=22)//请填写条件
{if (age1 >= 20) {Console.WriteLine("都达到法定婚龄啦");} else {Console.WriteLine("女方没有达到哟"); } } else {if (age1 >= 20) {Console.WriteLine("男方没有达到法定婚龄!"); } else { Console.WriteLine("都没有达到!");} }
{if (age1 >= 20) {Console.WriteLine("都达到法定婚龄啦");} else {Console.WriteLine("女方没有达到哟"); } } else {if (age1 >= 20) {Console.WriteLine("男方没有达到法定婚龄!"); } else { Console.WriteLine("都没有达到!");} }
2018-05-07
string[] name = new string[] { "景珍", "林惠洋", "成蓉", "洪南昌", "龙玉民", "单江开", "田武山", "王三明" };int[] score = new int[] {90,65,88,70,46,81,100,68 }; double avg =score.Average();Console.WriteLine("平均分"+avg+","+ "高于有:"); for (int a = 0; a < score.Length; a++) {if (score[a] >avg){ Console.Write(name[a]+" "); } }