2
I have to solve an exercise, and it says:
Do a procedure that receives an integer and positive n number. The procedure shall print all numbers in the range 0 to n which are divisible by 2 and 3 (simultaneously).
I’m starting at the moment, and I have very little baggage in data structure. I developed the code below, but does not return me the numbers that are divisible.
using System;
namespace revisao
{
class Program
    {               
        static void Imprimir(int[] vet, int indice)
        {               
            if (indice > 0 && indice < vet.Length)
            {
                if((vet[indice] % 2 == 0) && (vet[indice] % 3 == 0))
                {
                    Console.Write("{0,3}", vet[indice]);    
                    Imprimir(vet, indice + 1);
                }
                else
                {
                    Console.Write("Números não divisíveis por 2 e 3 simultaneamente!");
                }
            }
        }
        public static void Main(string[] args)
        {
            int i, tamanho;
            Console.Write("Digite o tamanho do vetor: ");
            tamanho = Convert.ToInt32(Console.ReadLine());
            int[] vetor = new int[tamanho];
            for(i = 0; i < vetor.Length; i++)
            {
                Console.Write("Digite o elemento {0}: ", i);
                vetor[i] = Convert.ToInt32(Console.ReadLine());
            }
            Imprimir(vetor, i);
            Console.ReadKey();
        }
    }
}