七月四日编程素养

1.null 和 undefined 的区别?

undefined表示变量已声明但是未定义,

null表示不存在这个变量。

2.查询出只选修了一门课程的全部学生的学号和姓名。

.

select sno,username  group by username having count(course)=1;

3.打印出所有的「水仙花数」,所谓「水仙花数」是指一个三位数,其各位数字立方和等于该数本身。例如:153 是一个「水仙花数」,因为 153=1的三次方+5 的三次方+3 的三次方。

private static void fun1(int i, int j) {
for(int a = i; a < j; a++){
int x = a/100%10;//百位数
int y = a/10%10;//十位数
int z = a%10;//个位数
if(x*x*x + y*y*y + z*z*z == a) {
System.out.println(a);
}

}

}


猜你喜欢

转载自blog.csdn.net/Code18112223576/article/details/80921056
今日推荐