注册 登录
编程论坛 新人交流区

C#编程题(用户输入31245,则输出5 4 2 1 3。)

trey 发布于 2007-09-30 09:21, 1112 次点击
编写一个应用程序,输入一个五位数,把这五个数分成单独的阿拉伯数字,并且把这五个数字用四个空格彼此分开逆序输出。
例如用户输入31245,则输出5 4 2 1 3。
static void Main(string[] args)
{
//
// TODO: 在此处添加代码以启动应用程序
//
//int a;
//int p;
int i;
string strInputNum;
int intInputNum;
int[] arrayInt;
arrayInt = new int[5];
Console.WriteLine("请输入上述的几个数:");
for(i=0;i<arrayInt.Length;i++)
{
strInputNum=Console.ReadLine().Trim();
intInputNum=Convert.ToInt16(strInputNum);
arrayInt[i]=intInputNum;
}
//for(i=0;i<arrayInt.Length;i++)
//{
// Console.WriteLine(arrayInt[i]);
//}
for(i=arrayInt.Length-1;i>=0;i--)
{
Console.WriteLine(arrayInt[i]);
}
}
6 回复
#2
kerr2007-09-30 17:31
#3
purana2007-09-30 17:53

你是想问啥?

#4
缘吇弹2007-09-30 17:55
我想他是想问,倒输出问题.
#5
purana2007-09-30 18:02
他的程序没错的.
#6
呀汗2007-09-30 18:08
。。。。。第三贴。。```
#7
缘吇弹2007-09-30 18:12
以下是引用purana在2007-9-30 18:02:30的发言:
他的程序没错的.

他可能是要努力灌水,争当合格坛民吧

1