第一题 Hello World! 

本题要求编写程序,输出一个短句“Hello World!”。

程序思路:直接输出即可。

知识点:使用的输出语句为 System.out.println();

结果

第二题求1到100的和

本题要求编写程序,计算表达式 1 + 2 + 3 + ... + 100 的值。

程序思路:首先定义整型变量 a和sum,当a<=100时循环sum+=a和a+1,当a>100时循环结束,返回sum值输出

知识点:整型int,for循环

结果:

第三题:分段计算居民水费

程序思路:利用if分之语句来判断,之后用输出语句输出

知识点:输入语句,if分之语句,输出语句

结果

打印九九乘法表

程序思路:运用了for循环,判断前面的数j是否小于等于后面的i,不是就进行下一次一循环;要求等号后面占四位,%-4d。        

运用知识点:for循环;i++;%-4d

结果public class Main {
  public static void main (String args[]){
    System.out.println("Hello World!");
  }
}

码云链接1.https://gitee.com/hlxwzyyyyzyq/codes/ut0ex62kmy35hvsjdfz1q75

2.https://gitee.com/hlxwzyyyyzyq/codes/7l0utzcy28hv9rx3gfiej80

3.https://gitee.com/hlxwzyyyyzyq/codes/06gokv5wjesqfyh2z47un594.

4.https://gitee.com/hlxwzyyyyzyq/codes/jiwnhe2tvyzqr7f65401s39

 

 
posted on 2018-09-16 19:24  张文竹  阅读(232)  评论(1编辑  收藏  举报