手写9x9乘法表,冒泡排序

9x9乘法表

class Demo {
public static void main(String[] args) {
for(int x = 0;x <= 9; x++) {
for(int y = 1;y <= x; y++) {
System.out.print(y+"*"+x+"="+x*y+"\t");
}
System.out.println();
}
}
}

冒泡排序

public class BubbleSort{
public static void main(String[] args){
int score[] = {67, 69, 75, 87, 89, 90, 99, 100};
for (int i = 0; i < score.length -1; i++){//最多做n-1趟排序
for(int j = 0 ;j < score.length - i - 1; j++){//对当前无序区间score[0......length-i-1]进行排序(j的范围很关键,这个范围是在逐步缩小的)
if(score[j] < score[j + 1]){ //把小的值交换到后面
int temp = score[j];
score[j] = score[j + 1];
score[j + 1] = temp;
}
}
System.out.print("第" + (i + 1) + "次排序结果:");
for(int a = 0; a < score.length; a++){
System.out.print(score[a] + "\t");
}
System.out.println("");
}
System.out.print("最终排序结果:");
for(int a = 0; a < score.length; a++){
System.out.print(score[a] + "\t");
}
}
}

手写9x9乘法表,冒泡排序的更多相关文章

  1. 9x9乘法表输出[Java]

    笔试,9x9乘法表输出的问题,看似简单,回来把当时写的结果输入一遍后发现,并没有想象中的“完美”.把改写的pos在此,警示...不要忘记任何细节. public class NXN { public ...

  2. 使用PHP几种写99乘法表的方式

    首先按照规矩,还是先废话一番,对于刚学PHP的新手来讲,用php写九九乘法表无疑是非常经典的一道练习题. 但不要小看这道练习题,它对于逻辑的考验还是相当到位的. 也许有人会觉得,九九乘法表有什么难的, ...

  3. 用python写九九乘法表

    用python来写九九乘法表,九九乘法表的结构是这样子的: 第一行是1 * 1 = 1,第二行是1 * 2 = 2 | 2 * 2 = 4...以此类推.注意到没,每一行的第一个乘的数字在从1到当行变 ...

  4. [Codevs 1230]元素查找(手写哈希表)

    题目连接:http://codevs.cn/problem/1230/ 说白了就是要我们自己手写一个哈希表的数据结构来实现加入和查找功能.map也能直接过(我第一次写就是用map骗AC的) 提一下个人 ...

  5. 用JS写九九乘法表

    本来JS部分觉得就不是很好,结果经过一个寒假,在家的日子过的太舒适,基本把学的都快忘干净了,今天老师一说九九乘法表,除了脑子里浮现出要满足的条件,其他的都不记得了,赶快整理了一下: <scrip ...

  6. 使用 for 循环 打印 9X9乘法表

    C 语言自学之99乘法表 请使用for循环,倒序打印9*9乘法表 1 #include <stdio.h> 2 3 int main() 4 { 5 int i,j,result;//定义 ...

  7. 回答了个问题,9x9 乘法表生成器

    # -*- coding: utf-8 -*- from prettytable import PrettyTable pt = PrettyTable() # 需要安装prettytable这个库来 ...

  8. PTA 7-42 整型关键字的散列映射(手写哈希表的线性探测法)

    本题考点: 整型哈希表的线性探测法 给定一系列整型关键字和素数P,用除留余数法定义的散列函数将关键字映射到长度为P的散列表中.用线性探测法解决冲突. 输入格式: 输入第一行首先给出两个正整数N(≤10 ...

  9. 用c写99乘法表

    int main(int argc,char **argv){ int a; for(a=1;a<=9;a++){ int b; for(b=1;b<=a;b++){ printf(&qu ...

随机推荐

  1. EditText控件常用属性

    常用属性 android:id——控件ID android:layout_width——控件宽度 android:layout_height——控件高度 android:text——文本内容 andr ...

  2. 20180716-Java正则表达式

    import java.util.regex.Matcher;import java.util.regex.Pattern; public class RegexMatches{ public sta ...

  3. ORACLE错误:ORA-28001: the password has expired解决方法

    Oracle提示错误消息ORA-28001: the password has expired,是由于Oracle11G的新特性所致, Oracle11G创建用户时缺省密码过期限制是180天(即6个月 ...

  4. 第一周训练 | STL和基本数据结构

    A - 圆桌问题: HDU - 4841 #include<iostream> #include<vector> #include<stdio.h> #includ ...

  5. linux之rpm软件包管理

    1.RPM包的命名规则 例如:httpd-2.2.15-15.el6.centos.1.i686.rpm httpd ·        软件包名 2.2.15        软件版本 15       ...

  6. python3爬虫开发与实战预览版

    https://germey.gitbooks.io/python3webspider/content/1.2.3-ChromeDriver%E7%9A%84%E5%AE%89%E8%A3%85.ht ...

  7. p4111 [HEOI2015]小Z的房间[简述矩阵树定理]

    分析 [1]无向图 图G的度数矩阵为D,邻接矩阵为A 我们定义这个图的Kirchhoff矩阵为D-A 这个矩阵的任意一个n-1阶主子式的行列式的绝对值就是这个图的生成树个数 [2]有向图 如果要求内向 ...

  8. cron 定时任两种配置方式

    第一种:xml文件方式 <bean id="commonTimer" class="com.course.wx.timer.CommonTimer"> ...

  9. VUEJS(vuejs) 数组数据不及时刷新

    在Vue对象中的methods属性中构建一个方法用于刷新data使用Vue.set方法进行手动刷新methods:{update:function(o){Vue.set(this,'list',o); ...

  10. Linux 初始化系统(init)- systemd

    wikipedia 浅析 Linux 初始化 init 系统 systemd 中文手册 fedoraproject - systemd 1. Systemd 简介 Systemd 是 Linux 系统 ...