A49827201 的作業 -->記得改成自己的學號

0 views
Skip to first unread message

Steven_Tian

unread,
Nov 9, 2010, 3:51:33 AM11/9/10
to Good Ideas
//最下面有一個括號被隱藏住了,記得加上去
public class A49827201 {
public static void main(String[] argv) {

int[] students = { 11,31,25,40,65,63,72,40,90,100 };
int fail=0;
int pass=0;

for (int i = 0; i < students.length; i++) {
System.out.println((i + 1) + " --- " + students[i]);
if(students[i]>60){
pass=pass+1;
}else if(students[i]<60){
fail= fail+1;
}
}

System.out.println("-------------------------------");
System.out.println("及格 : " + pass);
System.out.println("不及格 : " + fail);
System.out.println("-------------------------------");

}
}
Reply all
Reply to author
Forward
0 new messages