inicio
double[] pendiente = 17.24, 26.63, 5.94, 33.92, 3.71, 32.84, 35.93, 18.24, 6.92
double mayor = 0, menor = 0
read I = 0
mayor = pendiente[0]
menor = pendiente[0]
for (I = 1; I
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTbNI3UipPZ8X4vpN0RE7vOqatsY_C5cdph-ssTEvi79ti9OeBdBIPUbKkbs4EWMFAC35813z0nbpM-cTSqAYdvAYThg7CgXPix9vR-ch_MxvjWKAS38v0cxIqi7FH1jb9cEUZNyHkXY1p/s320/10.1c.bmp)
![Añadir imagen](http://www.blogger.com/img/blank.gif)
Escriba un programa que almacene los siguientes valores en un arreglo llamado pendientes: 17.24,25.63,5.94,33.92,3.71,32.84,35.93,18.24,6.92. el programa debe localizar los valores maximos y minimos del arreglo.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
double[] pendiente = { 17.24, 26.63, 5.94, 33.92, 3.71, 32.84, 35.93, 18.24, 6.92 };
double mayor = 0, menor = 0;
int I = 0;
mayor = pendiente[0];
menor = pendiente[0];
for (I = 1; I <> mayor)
{
mayor = pendiente[I];
}
}
for (I = 0; I <>
{
if (pendiente[I] < menor =" pendiente[I];">
} }
Console.WriteLine("el valor maximo es {0}: ", mayor);
Console.WriteLine("el valor minimo es {0}: ", menor);
Console.ReadLine(); } } }
ARREGLO LLAMADO PENDIENTES (visual).
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgz0gk4CuQ-7sC2nP0YbUqMZSV3hm_ZWAShwY7u4IshgsqJ5sqe2wEhH_7Qy7EKPPaKPU1TvXBzP2tWaFFW3eBIvZ-TeE2OrF7qyrWHutWK77O4ZIYvp6VA1IBvCqEET5Q9zE6pZ2ubR49w/s320/1.010visual.bmp)
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double[] pendiente = { 17.24, 25.63, 5.94, 33.92, 3.71,35.93, 18.24, 6.92,32.1 };
double mayor = pendiente[0];
double menor = pendiente[0];
int i;
listBox1.Items.Add("Pendientes:");
for (i = 0; i <= 8; i = i + 1) { listBox1.Items.Add(pendiente[i]); if (pendiente[i] > mayor)
{
mayor = pendiente[i];
}
if (pendiente[i] < menor =" pendiente[i];" text =" (" text =" (">
No hay comentarios:
Publicar un comentario