免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2590 | 回复: 0
打印 上一主题 下一主题

java程序设计入门教程习题--第四章(四) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-01-19 14:14 |只看该作者 |倒序浏览
初学者做习题

9.由命令行输入三个数a、b、c,请问它们是三角形的三个边吗?

//命令行输入三个数,判断是否能构成三角形。
public class Xiti4q9 {
public static void main(String args[]){
int a=Integer.parseInt(args[0]);
int b=Integer.parseInt(args[1]);
int c=Integer.parseInt(args[2]);
if ((a+b)>c && (a-b)
-----------------------------------------
#########################################

10.由命令行输入一个整数n,求s=1*1+2*2+...n*n?
  (a)使用while语句
  (b)使用do while语句
 (c)使用for语句

//命令行输入一个数n 求s=1*1+ 2*2+3*3+....+n*n
public class Xiti4q10 {
/*public static void main(String[] args){
  int n=Integer.parseInt(args[0]);
  int s=0;
  for (int i=1;i
/*public static void main (String[] args){
int n=Integer.parseInt(args[0]);
int s=0;
int i=1;
while (i
//由命令行输入一个成绩a,判断a属于那个级别F级:0-59 D级 60-69 C级 70-79 B级80-89
//A级 90-100
public class Xiti4q11 {
public static void main(String args[]) {
  int n = Integer.parseInt(args[0]);
  int i;
  if (n >= 0 && n = 60 && n = 70 && n = 80 && n = 90 && n

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/19637/showart_2153073.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP