你是指在DOS界面运行的那种程序吗?
还是web上的。
Web上的话,可以直接获取输入框中的数字转换成int类型,再求余获取。
int Mat = Int.Parse(TextBox1.Text.Trim());
int xxxx = Mat / 1000; //例如 4321 / 1000 = 4
int xxx = Mat % 1000 / 100; 例如 4321 % 1000 = 321 321 / 100 = 3
int xx = Mat % 100 / 10; 例如 4321 % 100 = 21 21 / 10 = 2
int x = Mat % 10; 例如 4321 % 10 = 1
DOS那种页面的话,要先获取你输入的数字。
a=1234
B=left(a,1)
C=right(left(a,2),1)
D=right(left(a,3),1)
E=right(a,1)