疯狂Java3

 class shu                                                                                                                                                                                                
    {
        public int[] show(){
        int[] i = new int[30];
        i [0] =1;
        i [1] =1;
        for (int k = 2; k < 30; k++){
            i[k] = i[k - 1] + i[k - 2];
        
        
        }
        return i;
        }
        public void showyy(ref int ji,ref int ou) {
            int[] i = show();
            foreach(int es in i){

                if (es % 2 == 0)
                {
                    ou++;


                }
                else {
                    ji++;
                }
            
            
            }

           
        
        }

 

 class Program
    {
        static void Main(string[] args)
        {
            shu p = new shu();
            int[] e4 = p.show();
            foreach (int es in e4)
            {
                Console.WriteLine(es);

               
            }
            int ji=0, ou=0;
            p.showyy(ref ji, ref ou);

            Console.WriteLine("奇数的个数是{0}:", ji);
            Console.WriteLine("偶数的个数是{0}:", ou);
            Console.ReadLine();
        }
    }
}


 

 

 

 

 


 

你可能感兴趣的:(疯狂Java3)