2018-12-19某百貨商場(chǎng)當(dāng)日消費(fèi)積分最高的8名顧客诀艰,他們的積分分別是18、25其垄、7、36臂外、13、2漏健、89橘霎、63.編寫程序找出最低的積分及它在數(shù)組中的原始位置。
using System.Text;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
int min;
int index = 0;
int[] points = { 18, 25, 7, 36, 13, 2, 89, 63 };
for (int i = 0; i <= 7; i++)
{
min = points[0];
if (points[i] < min)
{
min = points[1];
index = i;
}
? ? ? ? }
? ? ? ? Console.WriteLine("最小值為{0}瓦盛,所在的位置{1}",points [ index ],index+1);
? ? ? ? Console.ReadKey();