為什么這樣輸入正確呢?為什么是i < 7呢?
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? int[] score = new int[] {89,39,100,51,94,65,70 };//分?jǐn)?shù)
? ? ? ? ? ? Console.Write("不及格的有:");
? ? ? ? ? ? for (int i = 0; i < 7; i++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if(score[i] < 60 )//篩選條件
? ? ? ? ? ? ? ? ? ? Console.Write(score[i]+",");
? ? ? ? ? ? }
? ? ? ? }
? ? }
}
2020-04-19
因為你int數(shù)組里,有7個分?jǐn)?shù)啊,也可寫成 i<score.Length