Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
長い数字の数字を、数字の先頭から順番に1つずつ取得したい。while、for、ifを使ってやりたいです。何か案が?
int i = 123456; foreach (char c in i.ToString()) { Console.Write(c); }
数 n があるとします。
int n = 12345;
数字を取得する
int n = 12345; for (int i = 1; i <= n; i*=10) { int d = (n % (i*10))/i; Console.WriteLine(d); }