摘要: import java.util.Scanner; public class Dome1 { public static void main(String[] args) { int arr[] = {10,20,30,40,50}; for(int i =0;i<5;i++) { System.o 阅读全文
posted @ 2020-04-09 10:55 EarlGary 阅读(116) 评论(0) 推荐(0)
摘要: 打印出所有的"水仙花数",所谓"水仙花数"是指一个三位数,其各位数字立方和等于该数本身。例如:153是一个"水仙花数",因为153=1的三次方+5的三次方+3的三次方。(知识点:循环语句、条件语句) public class demo1 { public static void main(Strin 阅读全文
posted @ 2020-04-02 14:10 EarlGary 阅读(92) 评论(0) 推荐(0)
摘要: for循环 import java.util.*; public class demo1 { public static void main(String[] args) { int sum=0; for (int i = 1; i <=100 ; i++) { if (i%3==0){ sum+= 阅读全文
posted @ 2020-04-01 12:11 EarlGary 阅读(131) 评论(0) 推荐(0)
摘要: 1.编写程序, 输入变量x的值,如果是1,输出x=1,如果是5,输出x=5,如果是 10,输出 x=10,除了以上几个值,都输出x=none。(知识点:if条件语句) package Demo1; import java.util.Scanner; public class Demo2 { publ 阅读全文
posted @ 2020-03-26 11:52 EarlGary 阅读(130) 评论(0) 推荐(0)
摘要: 1.输入一个年份,判断是不是闰年(能被4整除但不能被100整除,或者能被400整除) package chap1; import java.util.Scanner; public class Main { public static void main(String[] args) { Syste 阅读全文
posted @ 2020-03-26 10:05 EarlGary 阅读(131) 评论(0) 推荐(0)
摘要: //数字互换作业//public class Exercise { public static void main(String[] args) { int a = 100; int b = 200; int tmp; tmp = a; a = b; b = tmp; System.out.prin 阅读全文
posted @ 2020-03-19 11:37 EarlGary 阅读(94) 评论(0) 推荐(0)
摘要: package chap; public class chap1 { public static void main(String[] args) { System.out.println("helllo happy world"); System.out.println("have a goood 阅读全文
posted @ 2020-03-11 12:23 EarlGary 阅读(54) 评论(0) 推荐(0)