c#編程實現100之內的加法

using System;
class myclass
{
    public void sum(int[] b, out int max, out int min)
    {
        int max;
        max = min = b[0];it

        for (int i = 1; i <= b.Length; i++)
        {
            max += b[i];class

        }
        for (int i = 1; i <= b.Length; i++)
        {
            if (i % 2 == 0)
                min += b[i];test

        }
    }
}
//public void sushu(  int n ,out int su00)
//{
// int su00=0;
// for (int i = 1; i < n; i++)
// {    if( i % 2 == 0)
//       sushu00 += i;
// }
//}static

class test
{
    static void Main()
    {
        myclass m = new myclass();
        int[] a;
        int i;
        for (i = 0; i <= 100; i++)
        {
            a[i] = i;
        }
        int sum, sushu;
        m.sum(a, out sum, out sushu);
        Console.Write("sum={0},sushu={1}", sum, sushu);
        Console.Read();new

    }
}void

相關文章
相關標籤/搜索