2. 以下程序的运行结果为_______。
class Program
{
static void Main(string[] args)
{
int[ ] a ={2,4,6,8,10,12,14,16,18};
for (int i=0; i <9; i++) {
Console.Write(" "+a[i]);
if ((i+1)%3==0) Console.WriteLine();
}
Console.ReadLine();
}
} 3. 以下程序的运行结果为_______。
class Program
{
static void Main(string[] args)
{
int s=0,i;
for (i=1; ; i++) {
if (s>50) break;
if (i%2==0) s+=i;
}
Console.WriteLine ("i=" + i + ",s=" + s);
Console.ReadLine();
}
} 4. 以下程序的运行结果为_______。
class Program
{
static void LE(ref int a, ref int b)
{
int x = a;
a = b;
b = x;
} static void Main(string[] args)
{
int x=10, y=25;
Console.WriteLine(x + "," + y);
LE(ref x, ref y);
Console.WriteLine (x + "," +y);
Console.ReadLine();
}
}
class Program
{
static void Main(string[] args)
{
int[ ] a ={2,4,6,8,10,12,14,16,18};
for (int i=0; i <9; i++) {
Console.Write(" "+a[i]);
if ((i+1)%3==0) Console.WriteLine();
}
Console.ReadLine();
}
} 3. 以下程序的运行结果为_______。
class Program
{
static void Main(string[] args)
{
int s=0,i;
for (i=1; ; i++) {
if (s>50) break;
if (i%2==0) s+=i;
}
Console.WriteLine ("i=" + i + ",s=" + s);
Console.ReadLine();
}
} 4. 以下程序的运行结果为_______。
class Program
{
static void LE(ref int a, ref int b)
{
int x = a;
a = b;
b = x;
} static void Main(string[] args)
{
int x=10, y=25;
Console.WriteLine(x + "," + y);
LE(ref x, ref y);
Console.WriteLine (x + "," +y);
Console.ReadLine();
}
}
解决方案 »
- winform datagridview 数据保存
- 如果将RichEdit包含格式的内容(RTF)保存到数据库中?(分下次补上,不好意思,没分了。)
- winform datagridview每行式样设定问题,有没有快点的方式?
- 高分求解!怎么用trimer控件来控制进度条
- .net后台代码如何获取Input(Text)的值
- 关于导出类问题!
- DropDownList怎样绑定?(急救!!!!!!!!!!!!!!!!!!!!!!!)
- 线程终止问题
- richbox用appendtext加载大型字符串时速度非常慢,有没有好的方法代替?
- 页面的局部更新
- 程序集绑定日志记录被关闭
- dataTimepicker控件值作为查询数据库条件格式~~~
2 4 6 8 10 12 14 16 18 2:
i=15,s=56 3:
10,25
25,10
楼主,这样学习不是好的方法,要考试不是这样补东西的,学好基础,自己试着去调试。