1个回答
展开全部
以下是我现写的
import java.util.Random;
public class Word {
public static void main(String args[]) {
int max = 0;
int min = 0;
String sum="";
for (int i = 0; i <= 100; i++) {
Random rand = new Random();
int r = rand.nextInt(99);
System.out.println(r);
if (r >= max) {
max = r;
} else if (r < min) {
min = r;
}
String s= ""+r;
if (r > 50) {
sum=sum+s+",";
}
}
System.out.println("max=" + max + "\n" + "min=" + min);
System.out.println(sum);
}
}
import java.util.Random;
public class Word {
public static void main(String args[]) {
int max = 0;
int min = 0;
String sum="";
for (int i = 0; i <= 100; i++) {
Random rand = new Random();
int r = rand.nextInt(99);
System.out.println(r);
if (r >= max) {
max = r;
} else if (r < min) {
min = r;
}
String s= ""+r;
if (r > 50) {
sum=sum+s+",";
}
}
System.out.println("max=" + max + "\n" + "min=" + min);
System.out.println(sum);
}
}
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |