C.E/Java
sum 함수
숨[Breath]
2013. 10. 19. 09:55
public class pno4 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int x[]={34,50,72,89,56};
int z=sum(x);
System.out.println(z);
}
private static int sum(int a[]){
int b=0;
for(int i=0; i<a.length; i++){
b+=a[i];
}
return b;
}
}