herrDeng網內搜尋

自訂搜尋

Ads

2013年9月9日 星期一

迴圈練習

int t[]={453,68,6768,78,89,56,34,87,3456,77};
請用為迴圈for, while, do-while計算他的平均。

39 則留言:

B10133029 彭義竣 提到...

// for
int t[]={453,68,6768,78,89,56,34,87,3456,77};
double sum = 0;
for (int i = 0; i < t.length; i += 1) {
sum = sum + t[i];
}
System.out.println(sum / t.length);
// while
int t[]={453,68,6768,78,89,56,34,87,3456,77};
double sum2 = 0;
int i = 0;
while (i < t.length) {
sum2 = sum2 + t[i];
i = i + 1;
}
System.out.println(sum2 / t.length);
// do-while
int t[]={453,68,6768,78,89,56,34,87,3456,77};
double sum3 = 0;
int i = 0;
do {
sum3 = sum3 + t[i];
i = i + 1;
} while (i < t.length);
System.out.println(sum3 / t.length);

B10133048 饒家華 提到...

public class CS {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println("for-loop:"+av);

int sum1=0;
double av1;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
System.out.println("while-loop:"+av);

int sum2=0;
double av2;
int i1=0;
do{
sum+=t[i1];
i++;
}while(i<t.length);
System.out.println(" do-while-loop:"+av);
}

}

B9833005 劉佳玟 提到...

public class Ex2 {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int t[]={67,66,87,65,98,97,65,55,69,59};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}

}

//////////

public class Ex3 {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int t[]={67,66,87,65,98,97,65,55,69,59};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/10;
System.out.println(av);

}

}

///////////



public class Ex4 {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

int t[]={67,66,87,65,98,97,65,55,69,59};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);


}



}

B9833005 劉佳玟 提到...


public class Ex2 {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int t[]={67,66,87,65,98,97,65,55,69,59};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}

}

//////////

public class Ex3 {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int t[]={67,66,87,65,98,97,65,55,69,59};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/10;
System.out.println(av);

}

}

///////////



public class Ex4 {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

int t[]={67,66,87,65,98,97,65,55,69,59};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);


}



}

B10133174 蔡翔宇 提到...

For迴圈
public class ex1{
public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double a;
for(int i=0; i<t.length; i++)
sum+=t[i];
a=(double)sum/10;
System.out.println(a);
}
}
while迴圈

public class ex2 {
public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double b;
int i=0;
while( i<t.length){
sum+=t[i];
i++;
}
b=(double)sum/10;
System.out.println(b);
}
}
do while迴圈

public class ex3 {
public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double c;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
c=(double)sum/10;
System.out.println(c);
}
}

B10133002 謝佩紋 提到...

public class ex1 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}

}


public class ex2 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/10;
System.out.println(av);

}

}

public class ex3 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);


}

}

b10133023徐顥 提到...

public class fo {
public static void main(String[] args){
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];

av=(double)sum/10;
System.out.print("for-pool,av=");
System.out.println(av);
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
System.out.print("whlie-pool,av=");
System.out.println(av);
int a=0;
do
{
sum+=t[a];
a++;
}while(a<t.length);
System.out.print("do whlie-pool,av=");
System.out.println(av);

}
}

B10133016王致翔 提到...

public class karama
{
public static void main(String[] args)
{
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.print("for-pool,av=");
System.out.println(av);
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
System.out.print("whlie-pool,av=");
System.out.println(av);
int a=0;
do
{
sum+=t[a];
a++;
}while(a<t.length);
System.out.print("do whlie-pool,av=");
System.out.println(av);

}
}

B10133036孫翊玲 提到...

public class aa {
public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println("for-loop:"+av);

int t1[]={453,68,6768,78,89,56,34,87,3456,77};
int sum1=0;
double av1;
int i=0;
while(i<t1.length){
sum1+=t1[i];
i++;
}
av1=(double)sum1/10;
System.out.println("while-loop:"+av1);

int t2[]={453,68,6768,78,89,56,34,87,3456,77};
int sum2=0;
double av2;
int i1=0;
do{
sum2+=t2[i1];
i1++;
}while(i1<t2.length);
av2=(double)sum2/10;
System.out.println("do-while-loop:"+av2);
}
}

B10133010蔡以翎 提到...

for迴圈

public class ex1 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}

}

while迴圈

public class ex2 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/10;
System.out.println(av);

}

}

do-while迴圈

public class ex3 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);


}

}

B10133004徐芷瑩 提到...

for迴圈

public class ex1 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}

}

while迴圈

public class ex2 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/10;
System.out.println(av);

}

}

do-while迴圈

public class ex3 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);


}

}

B10133009 王韋翔 提到...

public class test {
public static void main(String[] args)
{
//////////////for///////////////////////////
int m=0;
double sum1=0,x=0;
double a[]={453,68,6768,78,89,56,34,87,3456,77};
for(int i=0;i<a.length;i++)
{
m++;
sum1+=a[i];
}
x=sum1/m;
System.out.print("for="+x);
///////////////////////////////////////

/////////////while/////////////////////
double sum2=0,av=0;
int x=0;
double a[]={453,68,6768,78,89,56,34,87,3456,77};
while(x<a.length)
{
sum2=sum2+a[x];
x++;
}
av=sum2/x;
System.out.print("while="+av);
///////////////////////////////////


/////////////do-while///////////////////
double sum3=0,av=0;
int x=0;
double a[]={453,68,6768,78,89,56,34,87,3456,77};
do{
sum3+=a[x];
x++;
}while(x<a.length);
av=sum3/x;
System.out.println("do-while="+av);
///////////////////////////////////

}
}

B10133014 吳欣怡 提到...

public class ex1 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}
}


public class ex2 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/10;
System.out.println(av);
}
}

public class ex3 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);
}
}

B10133031 邱敏惠 提到...

public class a01 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}

}


public class a02 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/10;
System.out.println(av);

}

}

public class a03 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);


}

}

B10133011 黃怡蓁 提到...

public class abc01 {
public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}

}


public class abc02 {
public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/10;
System.out.println(av);
}

}


public class abc03 {
public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);
}

}

B10133042 沈俞宜 提到...

public class ex1 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}

}


public class ex2 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/10;
System.out.println(av);

}

}

public class ex3 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);


}

}

B10033185邱詩婕 提到...

public static void main(String[] args) {
// TODO Auto-generated method stub
int t[]={67,66,87,65,98,97,65,55,69,59};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);
}

}
----------------------------------
public static void main(String[] args) {
// TODO Auto-generated method stub
int t[]={67,66,87,65,98,97,65,55,69,59};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}

}
-------------------------------
ublic static void main(String[] args) {
// TODO Auto-generated method stub
int t[]={67,66,87,65,98,97,65,55,69,59};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);
}

}

B10133047 鄭兆珊 提到...

public class ex1 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}

}


public class ex2 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/10;
System.out.println(av);

}

}

public class ex3 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);


}

}

B10133053 古聿穎 提到...

public class ex2 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}

}


public class ex3 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/10;
System.out.println(av);

}

}

public class ex4 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);


}

}

B10133018翁湘姿 提到...

public class ex1 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}
}

public class ex2 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/10;
System.out.println(av);

}

}

public class ex3 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);

}
}

Unknown 提到...

D9935206 張憶文
ex2
public static void main(String[] args) {
int t[]={87,50,87,65,69,92,65,40,69,30};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/8;
System.out.println(av);
_____________________________
ex3
public static void main(String[] args) {
int t[]={67,70,56,65,80,97,63,70,80,59};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/9;
System.out.println(av);
___________________________
ex4
public static void main(String[] args) {
int t[]={70,52,17,96,53,74,51,40,89,56};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);

Unknown 提到...

D9935206 張憶文
ex2
public static void main(String[] args) {
int t[]={87,50,87,65,69,92,65,40,69,30};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/8;
System.out.println("for-loop:"+av);
_____________________________
ex3
public static void main(String[] args) {
int t[]={67,70,56,65,80,97,63,70,80,59};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/9;
System.out.println(av);
___________________________
ex4
public static void main(String[] args) {
int t[]={70,52,17,96,53,74,51,40,89,56};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);

B10133050張珈祥 提到...

public class paper {
public static void main(String[] args)
{
-----------------for

int m=0;
double sum1=0,x=0;
double a[]={453,68,6768,78,89,56,34,87,3456,77};
for(int i=0;i<a.length;i++)
{
m++;
sum1+=a[i];
}
x=sum1/m;
System.out.print("for="+x);

------------------------------------------------


-----------------while

double sum2=0,av=0;
int x=0;
double a[]={453,68,6768,78,89,56,34,87,3456,77};
while(x<a.length)
{
sum2=sum2+a[x];
x++;
}
av=sum2/x;
System.out.print("while="+av);

------------------------------------------------


-----------------do-while

double sum3=0,av=0;
int x=0;
double a[]={453,68,6768,78,89,56,34,87,3456,77};
do{
sum3+=a[x];
x++;
}while(x<a.length);
av=sum3/x;
System.out.println("do-while="+av);

------------------------------------------------

}
}

B10133030林潔如 提到...

public class ex1 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}

}


public class ex2 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/10;
System.out.println(av);

}

}

public class ex3 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);


}

}

B10133040 溫翊惠 提到...

public class EX1 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}

}

while迴圈

public class EX2 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/10;
System.out.println(av);

}

}

do-while迴圈

public class ex3 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);


}

}

B10133013 林子恩 提到...

public class aaa {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}
}


public class bbb {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/10;
System.out.println(av);
}
}

public class ccc {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);
}
}

B10133051張丞緯 提到...

public class AK1 {
public static void main(String[] args)
{
//////////////for///////////////////////////
int m=0;
double sum1=0,x=0;
double a[]={453,68,6768,78,89,56,34,87,3456,77};
for(int i=0;i<a.length;i++)
{
m++;
sum1+=a[i];
}
x=sum1/m;
System.out.print("for="+x);
///////////////////////////////////////

/////////////while/////////////////////
double sum2=0,av=0;
int x=0;
double a[]={453,68,6768,78,89,56,34,87,3456,77};
while(x<a.length)
{
sum2=sum2+a[x];
x++;
}
av=sum2/x;
System.out.print("while="+av);
///////////////////////////////////


/////////////do-while///////////////////
double sum3=0,av=0;
int x=0;
double a[]={453,68,6768,78,89,56,34,87,3456,77};
do{
sum3+=a[x];
x++;
}while(x<a.length);
av=sum3/x;
System.out.println("do-while="+av);
///////////////////////////////////

}
}

b10133032黃徐琨 提到...

public class ex1 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}
}


public class ex2 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/10;
System.out.println(av);
}
}

public class ex3 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);
}
}

B9933137 黃宇儂 提到...

public class ex1 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}
}


public class ex2 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/10;
System.out.println(av);
}
}

public class ex3 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);
}
}

B10133025 王柏文 提到...

public class EX1 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}

}


public class ex2 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/10;
System.out.println(av);

}

}

public class ex3 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);


}

}

b10133045林玹安 提到...



public class pig {
public static void main(String[] args){
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];

av=(double)sum/10;
System.out.print("for-pool,av=");
System.out.println(av);
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
System.out.print("whlie-pool,av=");
System.out.println(av);
int a=0;
do
{
sum+=t[a];
a++;
}while(a<t.length);
System.out.print("do whlie-pool,av=");
System.out.println(av);

}
}

B9933029江軒澔 提到...

public class ex1{
public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double a;
for(int i=0; i<t.length; i++)
sum+=t[i];
a=(double)sum/10;
System.out.println(a);
}
}
while迴圈

public class ex2 {
public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double b;
int i=0;
while( i<t.length){
sum+=t[i];
i++;
}
b=(double)sum/10;
System.out.println(b);
}
}
do while迴圈

public class ex3 {
public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double c;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
c=(double)sum/10;
System.out.println(c);
}
}

B10133173 呂俊良 提到...

public class ex1 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}

}


public class ex2 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/10;
System.out.println(av);

}

}

public class ex3 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);


}

}

B10133044吳盛盟 提到...

public class ex1 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}

}


public class ex2 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/10;
System.out.println(av);

}

}

public class ex3 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);


}

}

B10133003 王冠文 提到...

public class CS {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println("for-loop:"+av);

int sum1=0;
double av1;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
System.out.println("while-loop:"+av);

int sum2=0;
double av2;
int i1=0;
do{
sum+=t[i1];
i++;
}while(i<t.length);
System.out.println(" do-while-loop:"+av);
}

}

B9933161廖佳穎 提到...

public class ex1 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}

}


public class ex2 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/10;
System.out.println(av);

}

}

public class ex3 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);


}

}

B10133049 連于瑄 提到...

public class CS {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println("for-loop:"+av);

int sum1=0;
double av1;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
System.out.println("while-loop:"+av);

int sum2=0;
double av2;
int i1=0;
do{
sum+=t[i1];
i++;
}while(i<t.length);
System.out.println(" do-while-loop:"+av);
}

}

B10133020 李涵清 提到...

public class ex1 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}
}


public class ex2 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/10;
System.out.println(av);
}
}

public class ex3 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);
}
}

B10133008許耀文 提到...

public class ex1 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
for(int i=0; i<t.length; i++)
sum+=t[i];
av=(double)sum/10;
System.out.println(av);
}

}


public class ex2 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
while(i<t.length){
sum+=t[i];
i++;
}
av=(double)sum/10;
System.out.println(av);

}

}

public class ex3 {

public static void main(String[] args) {
int t[]={453,68,6768,78,89,56,34,87,3456,77};
int sum=0;
double av;
int i=0;
do{
sum+=t[i];
i++;
}while(i<t.length);
av=(double)sum/10;
System.out.println(av);


}

}

Related Posts Plugin for WordPress, Blogger...

熱門文章