摘要: 1. 打印出所有的"水仙花数",所谓"水仙花数"是指一个三位数,其各位数字立方和等于该数本身。例如:153是一个"水仙花数",因为153=1的三次方+5的三次方+3的三次方。(知识点:循环语句、条件语句) package pra; public class Text1 { public static 阅读全文
posted @ 2020-04-02 12:50 门凡博 阅读(119) 评论(0) 推荐(0)
摘要: 1. 分别使用for循环,while循环,do循环求1到100之间所有能被3整除的整数的和。(知识点:循环语句) (1)for循环 package pra; public class Text1 { public static void main(String[] args) { // TODO A 阅读全文
posted @ 2020-03-30 16:02 门凡博 阅读(148) 评论(0) 推荐(0)
摘要: 1.编写程序, 输入变量x的值,如果是1,输出x=1,如果是5,输出x=5,如果是 10,输出 x=10,除了以上几个值,都输出x=none。(知识点:if条件语句) package pra; import java.util.Scanner; public class Text1 { public 阅读全文
posted @ 2020-03-26 12:04 门凡博 阅读(118) 评论(0) 推荐(0)
摘要: 1.输入一个年份,判断是不是闰年(能被4整除但不能被100整除,或者能被400整除) package pra; import java.util.Scanner; public class Text1 { public static void main(String[] args) { // TOD 阅读全文
posted @ 2020-03-20 16:48 门凡博 阅读(136) 评论(0) 推荐(0)
摘要: package com.company; public class Main { public static void main(String[] args) { int a = 2; int b = 3; int tmp; //进行数据交换 tmp = a; a = b; b = tmp; Sys 阅读全文
posted @ 2020-03-19 11:39 门凡博 阅读(138) 评论(0) 推荐(0)
摘要: package hello; public class hello { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("Hello World"); } } 阅读全文
posted @ 2020-03-06 20:39 门凡博 阅读(73) 评论(0) 推荐(0)