SPEUDOCODIGO
int[] x = { 1, 2, 3, 4, 5, 6, 7, 8, 9,10};
int maximo = x[0];
int minimo = x[0];
int N = 0, intervalo = 0;
for (N = 0 to N <= 15 step N++)
{
for (N = 0 to N <>
{
if (x[N] > maximo)
{
maximo = x[N];
}
if (x[N] <>
{
minimo = x[N];
}
}
intervalo = maximo - minimo;
print"El intervalo de los valores del arreglo x es:{0} ",intervalo;
fin
CONSOLA
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EXAMEN_3_CONSOLA
{
class Program
{
static void Main(string[] args)
{
int[] x = { 1, 2, 3, 4, 5, 6, 7, 8, 9,10};
int maximo = x[0];
int minimo = x[0];
int N = 0, intervalo = 0;
for (N = 0; N <= 15; N++)
{
for (N = 0; N <>
{
if (x[N] > maximo)
{
maximo = x[N];
}
if (x[N] <>
{
minimo = x[N];
}
}
intervalo = maximo - minimo;
Console.WriteLine("El intervalo de los valores del arreglo x es:{0} ", intervalo);
Console.ReadKey();
}
}
}
}
WINDOWS
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace EXAMEN_3_VISUAL
{
public partial class Form1 : Form
{
int N, maximo, minimo, intervalo;
int[] x;
public Form1()
{
InitializeComponent();
x = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
maximo = x[0];
minimo = x[0];
}
private void button1_Click(object sender, EventArgs e)
{
for (N = 0; N <>
{
if (x[N] > maximo)
{
maximo = x[N];
}
if (x[N] <>
{
minimo = x[N];
}
}
intervalo = maximo - minimo;
listBox1.Items.Add("El intervalo de los valores del arreglo x es: " + intervalo.ToString());
}
private void button2_Click(object sender, EventArgs e)
{
Close();
}
}
}
No hay comentarios:
Publicar un comentario