Java编程--Day09

JavaScript 编程题

null 和 undefined 的区别?

MySQL 编程题

在这里插入图片描述

select sno,name
from students
group by name having count(course)=1

Java 编程题

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

undefined表示变量没有初始值,null表示不存的对象

2.mysql

SELECT sno,name
FROM students
GROUP BY username HAVING count(course)=1;

3.java

public static void main(String[] args) {
		for(int i=100; i<1000;i++){
			//个位
			int n = i%10;
			//十位
			int m = i / 10%10;
			//百位
			int k = i/100;
			if(Math.pow(n,3)+Math.pow(m,3)+Math.pow(k,3)==i){
				System.out.println(i);
			}
		}
	}

153
370
371
407

猜你喜欢

转载自blog.csdn.net/Ali_nie/article/details/83278422