day 01

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));
	}
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值