1 Star 0 Fork 2.1K

张硕函/activity-school_2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
15781013.java 847 Bytes
一键复制 编辑 原始数据 按行查看 历史
baiwenyu123 提交于 2024-04-06 13:51 . 添加排序代码
public class Color {
public enum color{,,绿,,};
public static void main(String arg[]){
int i,j,k,num=0;
color colors[]=color.values();
System.out.println("从红,蓝,绿,黄,黑这五种颜色中取出三种不同颜色的排列有以下可能性:");
for(i=0;i<colors.length;i++){
for(j=0;j< colors.length;j++){
if(j==i){
continue;
}
else{
for(k=0;k< colors.length;k++) {
if((k!=i) && (k!=j)){
num=num+1;
System.out.println( "第"+num + "种情况" + " " + colors[i] + " " + colors[j] + " " + colors[k]);
}
}
}
}
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/zhang-shuohan/activity-school_2.git
git@gitee.com:zhang-shuohan/activity-school_2.git
zhang-shuohan
activity-school_2
activity-school_2
master

搜索帮助

A270a887 8829481 3d7a4017 8829481