Popular Post

Posted by : Unknown jueves, 12 de junio de 2014



Realizar un programa en C que permita ingresar un vector A de 10 elementos y obtener un vector B con los múltiplos del 4

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication41
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = new int[10];
            int[] b = new int[10];
            int m = 0, i;
            for (i = 0; i < 10; i++)
            {
                Console.Write("a[{0}]=", i);
                a[i] = Convert.ToInt32(Console.ReadLine());
                if (a[i] % 4 == 0 && a[i] != 1)
                {
                    b[m] = a[i];
                    m++;
                }
            }
            for (i = 0; i < m; i++)
                Console.WriteLine("b[{0}]={1}", i, b[i]);
            Console.ReadKey();

        }
    }
}

Leave a Reply

Subscribe to Posts | Subscribe to Comments

- Copyright © Programación #5 - Date A Live - Powered by Blogger - Designed by Johanes Djogan -