LoginSignup
1
2

More than 3 years have passed since last update.

標準入力値のスペース区切りの方法

Posted at

文字列の場合

string[] array = Console.ReadLine().Split(' ');
string m = array[0];
string n = array[1];

数字の場合

string[] array = Console.ReadLine().Split(' ');
int m = int.Parse(array[0]);
int n = int.Parse(array[1]);
1
2
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
1
2