A: Y=0
B: X=1
C: Y=0
D: X=0
举一反三
- 写出下列程序的运行结果 void main() { int x=10,y=10; Console.WriteLine("x={0},y={1}",x--,--y); }
- int x = 3,y = 4;以下哪条输出语句正确? A: Console.WriteLine("x={x},y={y}", x,y); B: Console.WriteLine("x={x},y={y}"); C: Console.WriteLine("x={0},y={1}", x,y); D: Console.WriteLine("x={1},y={2}", x,y);
- 1. 写出以下程序的运行结果。 class Test { public static void Main() { int x = 5; int y = x++; Console.WriteLine(y); y=++x; Console.WriteLine(y); Console.WriteLine(x); } } 运行结果:
- int x = 3,y = 4;以下哪条输出语句正确? A: Console.WriteLine("x={x},y={y}", x,y); B: Console.WriteLine("x={x},y={y}"); C: Console.WriteLine("x={0},y={1}", x,y); D: Console.WriteLine("x={1},y={2}", x,y);
- 输入一个整数,将各位数字反转后输出,将程序填充完整static void Main(string[] args){Console.WriteLine("请输入一个整数");string x = Console .ReadLine ();int y = int.Parse (x);for(int i=0;i<;x.Length ;i++){Console.Write(y%10);;}}
内容
- 0
using System; class Test { public static void Main() { int x = 5; int y = x++; Console.WriteLine(y); y=++x; Console.WriteLine(y); } }
- 1
阅读下面的程序,分析代码是否能够编译通过,如果能编译通过,请列出运行的结果。否则请说明编译失败的原因。public class Test02{public static void Main(string[] args){int x = 12; {int y = 96;Console.WriteLine("x is " + x);Console.WriteLine("y is " + y);}y = x;Console.WriteLine("x is " + x);}}
- 2
写出以下程序的运行结果。using System;class Test{public static void Main(){int x = 5;int y = x++;Console.WriteLine(y);//第1空y=++x;Console.WriteLine(y);//第2空}}
- 3
下面程序段输出的结果是什么 class Sample{ static void Swap(ref int x, ref int y) { int tmp; tmp = x; x = y; y = tmp; } static void Main(string[] args) { int a = 30, b = 40; Swap(ref a, ref b); Console.WriteLine("{0},{1}", a, b); Console.ReadKey(); } }
- 4
以下程序的运行结果是( )。 main() { int a=-5,b=1,c=1; int x=0,y=2,z=0; if(c>0) x= x + y; if(a<=0) { if(b>0) if(c<=0) y= x - y; } else if(c>0) y= x - y; else z= y; printf("%d,%d,%d\n", x, y, z); }