martes, 23 de septiembre de 2008

Practica 1

Elaborar un programa que pida numeros enteros e imprima el mayor ,el menor y la diferencia.
corrida de escritorio

using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int n, mayor = 0, menor = 9999;
Console.Write("Introduce la cantidad de valores enteros : ");
n = int.Parse(Console.ReadLine());
int[] emax = new int[n];
int i;
Console.WriteLine(" introduzca los {0} valores enteros ", n);
for (i = 0; i <> mayor)
{
mayor = emax[i];
}
if (emax[i] < menor)
{
menor = emax[i];
}
}
Console.WriteLine("El dato mayor es : {0}", mayor);
Console.WriteLine("El dato menor es : {0}", menor);
int dif = mayor - menor;
Console.WriteLine("La diferencia es : {0}", dif);
Console.ReadLine();
}
}
}




No hay comentarios: