알 수 없는 사용자 2014. 4. 8. 13:13

using UnityEngine;

using System.Collections;


public class ExTriangle : MonoBehaviour {


// Use this for initialization

void Start () {

float[] a = new float[]{1.0f, 2.0f, 3.0f, 4.0f} ;

float s = GetSum (a[0], a[1], a[2], a[3]);

print (s);

float s1;

s1 = GetSum1(a);

print (s1);

}

/*

string GetDay(int day){

if(day == 1)

return "Hello";

else

return "world";

}

*/

float GetSum(float a, float b, float c, float d){

float sum = a + b + c + d;

return sum;

}

float GetSum1(float[] a){

float sum1 = 0;

for(int i = 0; i < a.GetLength(0); i++){

sum1 = sum1 + a[i];

}

return sum1;

}

// Update is called once per frame

void Update () {

}

}