基本信息
源码名称:JAVA语言程序设计(基础篇)第5章答案
源码大小:0.36M
文件格式:.doc
开发语言:Java
更新时间:2019-10-12
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
5.1统计正数和负数的个数然后计算这些数的平均值
5.10找出能被5和6整除的数
5.11找出能被5或6整除,但不能被两者同时整除的数
5.12求满足n的平方大于12000的n的最小值
5.13求满足n的立方小于12000的n的最大值
5.14计算最大公约数
5.15显示ASCII码字符表
5.16找出一个整数的因子
5.16找出一个整数因子
5.17显示金字塔
5.18使用循环语句打印4个图案?
5.19打印金字塔形的数字?
package nameyu; import java.util.Scanner; public class Test { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub System.out.print("Enter an integer, the input end if it is 0:"); Scanner input=new Scanner(System.in); // int n=input.nextInt(); double sum=0,ave; int positive=0,negative=0,count=0; int n=input.nextInt(); while(n==0){ System.out.println("nonononono"); break; } while(n!=0){ sum =n; count; if(n>0){ positive ; }else negative ; n=input.nextInt(); ave=sum/count; System.out.println("The number of positives is " positive); System.out.println("The number of negatives if " negative); System.out.println("The total is " sum); System.out.println("The average is " ave); } } }