PRACTICA 8.1
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace pract_8._1_consola
{
class Program
{
static void Main(string[] args)
{
int[] temp = new int[8];
int suma = 0, i, p;
Console.WriteLine("INTRODUCE LOS SIGUIENTES ELEMENTOS:");
for (i = 0; i <>
{
Console.Write("DATO {0}:", i);
temp[i] = int.Parse(Console.ReadLine());
suma += temp[i];
}
p = suma / 8;
Console.WriteLine("\n LISTA DE 8 ELEMENTOS:");
for (i = 0; i <>
{
Console.WriteLine(temp[i]);
}
Console.WriteLine("PROMEDIO={0}", p);
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _8._2_a_consol
{
class Program
{
static void Main(string[] args)
{
int[] emax = new int[10];
int i, mayor, pos = 1;
Console.WriteLine("INTRODUCE UN NUMERO ENTERO:");
emax[0] = int.Parse(Console.ReadLine());
mayor = emax[0];
for (i = 1; i <>
{
Console.WriteLine("introduce un dato[{0}]:", i);
emax[i] = int.Parse(Console.ReadLine());
if (emax[i] > mayor)
{
mayor = emax[i];
pos = i;
}
}
Console.WriteLine("Listado de 10 Numeros enteros");
for (i = 0; i <>
{
Console.WriteLine(emax[i]);
}
Console.WriteLine("\nEl valor Maximo es:{0} ", mayor);
Console.WriteLine("\nESTE ES EL ELEMENTO {1} EN LA LISTA DE NUMEROS", mayor, pos);
Console.ReadKey();
}
}
}
PRACTICA 8.2 C
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _8._2_c_consol
{
class Program
{
static void Main(string[] args)
{
int[] emax = new int[10];
int i, menor, pos = 1;
Console.WriteLine("INTRODUCE UN NUMERO ENTERO:");
emax[0] = int.Parse(Console.ReadLine());
menor = emax[0];
for (i = 1; i <>
{
Console.WriteLine("introduce un dato[{0}]:", i);
emax[i] = int.Parse(Console.ReadLine());
if (emax[i] <>
{
menor = emax[i];
pos = i;
}
}
Console.WriteLine("Listado de 10 Numeros enteros");
for (i = 0; i <>
{
Console.WriteLine(emax[i]);
}
Console.WriteLine("\nEl valor MENOR es:{0} ", menor);
Console.WriteLine("\nESTE ES EL ELEMENTO {1} EN LA LISTA DE NUMEROS", menor, pos);
Console.ReadKey();
}
}
}
8.3 CONSOLA
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _8._3_CONSOL
{
class Program
{
static void Main(string[] args)
{
int I;
double[] corriente = new double[10];
double[] voltios = new double[10];
double[] resistencia = new double[10];
for (I = 0; I <>
{
Console.Write("INTRODUCE DATO PARA RESISTENCIA {0}:", I + 1);
resistencia[I] = double.Parse(Console.ReadLine());
}
Console.WriteLine("");
for (I = 0; I <>
{
Console.Write("INTRODUCE CORRIENTE {0}:", I + 1);
corriente[I] = double.Parse(Console.ReadLine());
voltios[I] = (corriente[I] * resistencia[I]);
}
Console.WriteLine("\tCORRIENTE " + "\tRESISTENCIA " + "VOLTIOS");
for (I = 0; I <>
{
Console.WriteLine("\t" + corriente[I] + " \t\t" + resistencia[I] + "\t\t " + voltios[I]);
}
Console.ReadLine();
}
}
}
No hay comentarios:
Publicar un comentario