day 01
程序员文章站
2022-03-05 11:21:05
...
1 用javascript编写九九乘法表
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>99乘法表</title>
<style type="text/css">
#first {
width: 800px;height: 500px;
}
</style>
</head>
<body>
<div id="first">
</div>
<script type="text/javascript">
function chengfa() {
var tr = "";
for (var i = 1; i <= 9; i++) {
for (var j = 1; j <= i; j++) {
tr += i + '*' + j + '=' + i * j + ' ';
if (i == j) {
tr += "<br>";
}
}
}
document.getElementById('first').innerHTML = tr;
}
chengfa();
</script>
</body>
</html>
2 表名 User
DROP TABLE IF EXISTS user;
CREATE TABLE `user` (
`name` varchar(255) DEFAULT NULL,
`tel` int(255) DEFAULT NULL,
`content` varchar(255) DEFAULT NULL,
`date` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT `user`(name,tel,content,date) VALUES('tom',1111,'大专毕业','2006-10-11');
INSERT `user`(name,tel,content,date) VALUES('jack',1111,'本科毕业','2006-10-15');
INSERT `user`(name,tel,content,date) VALUES('tonny',1111,'中专毕业','2006-10-18');
-- 1、有一新记录(heby 2222 中专毕业2006-10-20),请用SQL语句新增至表中。
INSERT `user`(name,tel,content,date) VALUES('heby',2222,'中专毕业','2006-10-20');
-- 2、请用 SQL 语句,把tom的时间更新为当前系统时间。
UPDATE `user` SET DATE = NOW() WHERE name = 'tom';
-- 3、请写出删除姓名为heby的全部记录。
DELETE FROM `user` WHERE name = 'heby';
3 有 1、2、3、4 个数字,能组成多少个互不相同且无重复数字的三位数?都是多少?
package Demo;
public class Test {
public static void main(String[] args) {
String str = "";
//遍历百位
for (int i = 1; i <= 4; i++) {
//遍历十位
for (int j = 1; j <= 4; j++) {
//若和百位相同,则跳出循环
if (j == i) {
continue;
}
//遍历个位
for (int k = 1; k <= 4; k++) {
//若和百位或者十位相同,则跳出循环
if (k == j || k == i) {
continue;
}
str += (i * 100 + j * 10 + k + ",");
}
}
}
/*public String substring(int beginIndex, int endIndex) {
if (beginIndex < 0) {
throw new StringIndexOutOfBoundsException(beginIndex);
}
if (endIndex > value.length) {
throw new StringIndexOutOfBoundsException(endIndex);
}
int subLen = endIndex - beginIndex;
if (subLen < 0) {
throw new StringIndexOutOfBoundsException(subLen);
}
return ((beginIndex == 0) && (endIndex == value.length)) ? this
: new String(value, beginIndex, subLen);
}*/
System.out.print(str.substring(0, str.length() - 1));
}
}