Você está na página 1de 3

exercício 5

            int X;

            int[] A = new int[7];

            int[] B = new int[7];

            int[] C = new int[14];

            string texto;

            texto = "";

            for(X = 0; X <= 13; X++)

      {

                if (X <= 6)

        {

                    Console.WriteLine("Digite o " + (X + 1) + " valor do vetor A");

                    A[X] = Convert.ToInt32(Console.ReadLine());

                    Console.WriteLine("Digite o " + (X + 1) + " valor do vetor B");

                    B[X] = Convert.ToInt32(Console.ReadLine());

                    C[X] = A[X];

        }

                else {

                   C[X] = B[X - 7];

        }

                texto += "C[" + X + "]=" + C[X] + "\n";

      }

            Console.WriteLine(texto);

exercício 6
            int X;

            int[] A = new int[5];

            int[] B = new int[10];

            int[] C = new int[15];

            string texto;

            texto = "";

            for (X = 0; X <= 14; X++) {

                if (X <= 4) {

                    Console.WriteLine("Digite o " + (X + 1) + " valor do vetor A", "Digite aqui!");

                    A[X] = Convert.ToInt32(Console.ReadLine());

                    C[X] = A[X];

        }

                else {

                    Console.WriteLine("Digite o " + (X - 4) + " valor do vetor B", "Digite aqui!");

                    B[X - 5] = Convert.ToInt32(Console.ReadLine());

                    C[X] = B[X - 5];

                

                  texto += "C[" + X + "]=" + C[X] + "\n";

        }

      }

            Console.WriteLine(texto);

Exercício 7

            int X;

            int[] A = new int[10];

            int[] B = new int[10];

            string texto;

            texto = "";
            for (X = 0; X <= 9; X++)

      {

                Console.WriteLine("Digite o " + (X + 1) + " valor do vetor A");

                A[X] = Convert.ToInt32(Console.ReadLine());

                B[X] = A[X] * A[X];

                texto += A[X] + " ao quadrado vale: " + B[X] + "\n";

      }

            Console.WriteLine(texto);

Você também pode gostar