- Back to Home »
- Multiplos de 4 vectores
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();
}
}
}