LoginSignup
0
0

More than 5 years have passed since last update.

【c#】foreachを使って、配列の値をすべて表示する

Last updated at Posted at 2018-06-06

using System;

namespace foreach_sample
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            //foreachを使って、配列の値をすべて表示する

            // 1. 配列を初期化
            float[] weights = { 61.2f, 62.5f, 64.9f, 63.2f, 65.1f, 63.6f, 67.9f };

            // 2. foreachを回す
            //foreach (型名 変数名 in 配列名)
            foreach (float w in weights)
            {
                Console.WriteLine(w);
            }
        }
    }
}

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0