C# 练习题 循环结构
U3D_ 晨测试题_day04 1. 写出下列程序运行结果,若有错,请指出并改正. class Program { static void Main( string[] args ) { int x = 5; int y = 5; int z = 5; x++; Console.Write( x ); Console.Write( y++ ); Console.Write( ++z ); bool b = 20-(15-8)*2 > 10 && (2%2*2+2) > 2 ; Console.Write( b ); } } X=6 , y=5 ,z=6 解释:本题考查:算术运算符,++(自增运算符)的基本使用。 2. 下列语句中,能正确表示逻辑关系“a>=10”或“a<=0”的C#表达式的是(D)。 a>=10 or a<=0 a>=10 | a<=0 a>=10 && a<=0 a>=10 || a<=0 解释:本题考查C#中逻辑运算符,&&,||,!三种。 3. 下列几项运算符中运算结果正确的项是( C D E )。 Console.WriteLine( 0.8*3 ); //结果为2 改:2.4 Console.WriteLine( 2/0.5 );//结果为0.4 改:4 Console.WriteLine( 5/10 );//结果为0 Console.WriteLine(