摘要: 面试题:不使用任何中间变量,交换a,b两个数字的值 阅读全文
posted @ 2013-06-18 23:53 天涯雪 阅读(639) 评论(0) 推荐(0) 编辑
摘要: 面试题:有两个变量a和b,不用"if","?","switch"或其他判断语句,找出两个数中间比较大的。利用绝对值来找到最大值。int max = ((a + b) + Math.abs(a - b)) /2;private int CompareInt(int a,int b) { int c = (a+b + Math.abs(a - b)) /2; return c;} 阅读全文
posted @ 2013-06-18 23:41 天涯雪 阅读(468) 评论(0) 推荐(0) 编辑