20091110

PRACTICA 10.1ARREGLO LLAMADO PENDIENTES (consola,visual)

pseudocodigo.
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 < menor =" pendiente[I]" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTbNI3UipPZ8X4vpN0RE7vOqatsY_C5cdph-ssTEvi79ti9OeBdBIPUbKkbs4EWMFAC35813z0nbpM-cTSqAYdvAYThg7CgXPix9vR-ch_MxvjWKAS38v0cxIqi7FH1jb9cEUZNyHkXY1p/s1600-h/10.1c.bmp">Añadir imagen




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).






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