static void Main(string[] args)
{
Console.WriteLine("ingrese la cantidad de competidores");
string valor = Console.ReadLine();
int num = Convert.ToInt32(valor);
double[] score = new double[num];
for (int i = 0; i < num; i++)
{
Console.WriteLine("Ingrese el tiempo del competidor " + (i + 1));
score[i] = Convert.ToDouble(Console.ReadLine());
}
Array.Sort(score);
Array.Reverse(score);
if (score.Length > 2)
{
Console.WriteLine("el primer puesto es para el competidor con el tiempo de "+ score[0]);
Console.WriteLine("el segundo puesto es para el competidor con el tiempo de " + score[1]);
Console.WriteLine("el tercer puesto es para el competidor con el tiempo de " + score
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Practica1_GitHub
{
class Program
{
static void Main(string[] args)
{
int cantidad;
string ingresar;
Console.WriteLine("Ingrese la cantidad de competidores");
ingresar = Console.ReadLine();
cantidad = Convert.ToInt32(ingresar);
string[] nombre = new string[cantidad];
int[] tiempos = new int[cantidad];
Console.WriteLine("\nIngrese los datos de los competidores");
for (int i = 0; i < cantidad; i++)
{
Console.WriteLine("Nombre del competidor");
nombre[i] = Console.ReadLine();
Console.WriteLine("Tiempo del competidor");
tiempos[i] =
class Program
{
private static int[] scores = new int[] { 5, 3, 4, 6, 1, 2 };
private static string[] names = new string[] { "Oswaldo", "Manuel", "Eduardo", "David", "Bryan", "Javier" };
private static void Main(string[] args)
{
int[] scores = new int[] { 5, 3, 4, 6, 1, 2 };
string[] names = new string[] { "Oswaldo", "Manuel", "Eduardo", "David", "Bryan", "Javier" };
int[] sortedScores = SortScores(scores);
string[] sortedNames = SortNames(sortedScores);
Console.WriteLine($"First place: {sortedNames[0]} ({sortedScores[0]})");
Console.WriteLine($"Second place: {sortedNames[1]} ({sortedScores[1]})");
Console.WriteLine($"Third place: {sortedNames[2]} ({sortedScores
public void premiacion()
{
Console.WriteLine("Ingresar numero de competidores");
int numCompetidores = int.Parse(Console.ReadLine());
int[] tiempos = new int[numCompetidores];
int temp = 0;
for (int i = 0; i < tiempos.Length; i++)
{
Console.WriteLine($"Ingresar tiempo competidor {i + 1}");
tiempos[i] = int.Parse(Console.ReadLine());
}
for (int i = 0; i < tiempos.Length; i++)
{
for (int j = 0; j < tiempos.Length - 1; j++)
{
if (tiempos[j] > tiempos[j + 1])
{
temp = tiempos[j + 1];
tiempos[j + 1] = tiempos[j];
tiempos[j] = temp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace calificacion_promedio_maxima_y_minima
{
class Program
{
static void Main(string[] args)
{
/* Solicitar la cantidad de estudiantes a evaluar */
Console.WriteLine("Ingrese la cantidad de estudiantes a evaluar: ");
int num_estudiantes = int.Parse(Console.ReadLine());
/* Inicializar variables para el cálculo de la calificación promedio, máxima y mínima */
int suma_calificaciones = 0;
int calificacion_maxima = 0;
int calificacion_minima = 10; /* Iniciamos con el valor máximo posible para asegurarnos de obtener un valor menor */
/* Capturar
//2. En un club de atletismo se deben indicar las premiaciones mediante
un programa así:
Usando ciclos debe pedir por consola el número de competidores
Ingresar por teclado los tiempos de cada competidor.
Mostrar en consola los tres mejores tiempos, acompañados con el
texto primer, segundo y tercer puesto con su respectivo puntaje.
Nota: Los tiempos más cortos serán los ganadores
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int competidores;
Console.Write("Ingrese numero de competidores: ");
competidores = int.Parse
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
// Solicitar la cantidad de usuarios a valorar
Console.Write("Ingrese la cantidad de usuarios a valorar: ");
int numUsuarios = int.Parse(Console.ReadLine());
// Inicializar variables para el cálculo de la calificación promedio, máxima y mínima
int sumaCalificaciones = 0;
int calificacionMaxima = 0;
int calificacionMinima = 10; // Iniciamos con el valor máximo posible para asegurarnos de obtener un valor menor
// Capturar nombre y calificación de los estudiantes
for (int i = 0; i < numUsuarios; i++)
{
Console.Write("Ingrese el nombre del estudiante
//Definir la funcion
def competencia():
print("Ingrese la cantidad de competidores")
cantidad = int(input())
print("")
lista = []
for i in range (cantidad):
lista.append(float(input("Ingrese el tiempo del competidor")))
lista.sort()
print(lista)
#llamar la funcion
competencia()
int cont = 1;
int i = 1;
for (i = 1; i <= cont; i++) {
Console.WriteLine("ingrese el tiempo del " + i + "° competidor");
string tCompetidor = Console.ReadLine();
int competidor = Convert.ToInt32(tCompetidor);
Console.WriteLine("El tiempo del competidor " + i + " es " + competidor);
}
using System;
namespace Ejercicio_4
{
class Program
{
static void Main(string[] args)
{
int[] tiempos = new int[10];
int[] puntaje = { 5, 3, 1 };
string[] puesto = { "primero", "segundo", "tercero" };
int[] ordenado = new int[10];
int i, j, aux;
Console.WriteLine("Ingresar los tiempos de los corredores\"separados por comas\"");
string[] linea = Console.ReadLine().Split(',');
for (i = 0; i < tiempos.Length; i++)
{
tiempos[i] = Convert.ToInt32(linea[i]);
ordenado[i] = tiempos[i];
}
for (i = 0; i < tiempos.Length; i++)
{
for (j = i + 1; j < tiempos.
for (int i = 0; i < competidores; i++)
{
Console.WriteLine("Ingrese el nombre del competidor");
nombre = Console.ReadLine();
Console.WriteLine("Ingrese el tiempo del competidor");
tiempo = double.Parse(Console.ReadLine());
Competidor competidor = new Competidor(nombre, tiempo);
listaCompetidores.Add(competidor);
}
listaCompetidores.Sort((x, y) => x.Tiempo.CompareTo(y.Tiempo));
for (int i = 0; i < 3; i++)
{
Console.WriteLine(listaCompetidores[i].Nombre + " " + listaCompetidores[i].ToString());
}
int competidores;
Console.WriteLine("Ingrese la cantidad de competidores");
competidores = Convert.ToInt32(Console.ReadLine());
// Creamos un vector para los tiempos y otro para el puesto
int[] tiempos = new int[competidores];
int[] puesto = new int[competidores];
// Recibimos los tiempos de cada competidor
for (int i = 0; i < competidores; i++)
{
Console.WriteLine("Ingrese el tiempo del competidor {0}:", i+1);
tiempos[i] = Convert.ToInt32(Console.ReadLine());
}
//Ordenamos el vector de menor a mayor
Array.Sort(tiempos);
// Mostramos los tres mejores tiempos
for (int i = competidores - 1, j = 1; i > competidores - 4; i--, j++)
{
Console.Write
int numeroCompetidores = int.Parse(Console.ReadLine());
int[] tiempoCompetidores = new int[tamano];
for (int i = 0; i < tiempoCompetidores.Length; i++)
{
tiempoCompetidores[i] = int.Parse(Console.ReadLine());
}
int[] tiempoOrdenado = new int[tamano];
tiempoOrdenado = tiempoCompetidores;
tiempoOrdenado.OrderBy(t => t);
Console.WriteLine("Primer puesto: " + tiempoOrdenado[0]);
Console.WriteLine("Segundo puesto: " + tiempoOrdenado[1]);
Console.WriteLine("Tercer puesto: " + tiempoOrdenado[2]);
public static void ganadores(int nATLETAS )
{
{
List<double> times = new List<double>();
for (int i = 0; i < nATLETAS; i++)
{
Console.WriteLine("Ingrese los tiempos del competidor {0}", i);
times.Add(double.Parse(Console.ReadLine()));
}
times.Sort();
Console.WriteLine("Primer Puesto: {0}", times[0]);
Console.WriteLine("Segundo Puesto: {0}", times[1]);
Console.WriteLine("Tercer Puesto: {0}", times[2]);
}
}
int competitors = int.Parse(Console.ReadLine());
int[] times = new int[competitors];
for(int i = 0; i < competitors; i++)
{
times[i] = int.Parse(Console.ReadLine());
}
int max = times.Max();
int min = times.Min();
int med = times.Sum() / times.Length;
Console.WriteLine(min);
Console.WriteLine(med);
Console.WriteLine(max);
int competidores = int.Parse(Console.ReadLine());
int[] times = new int[competidores];
for (int i = 0; i < times.Length; i++)
{
times[i] = int.Parse(Console.ReadLine());
}
Array.Sort(times);
for (int i = 0; i < times.Length; i++)
{
times[i] = int.Parse(Console.ReadLine());
}
Console.WriteLine("Primer Puesto");
Console.WriteLine("Segundo Puesto");
Console.WriteLine("Tercer Puesto");
int cantidad = 0;
string aux = "";
bool esNumero = false;
Console.WriteLine("Ingrese la cantidad de competidores: ");
aux = Console.ReadLine();
esNumero = int.TryParse(aux, out cantidad);
int[] tiempos = new int[cantidad];
int i = 0;
while (i < cantidad)
{
Console.WriteLine("Ingrese el tiempo del competidor " + (i + 1));
aux = Console.ReadLine();
esNumero = int.TryParse(aux, out tiempos[i]);
i++;
}
//Ordenar los tiempos de menor a mayor
int j = 0;
while (j < cantidad - 1)
{
int k = j + 1;
while (k < cantidad)
{
if (tiempos[j] > tiempos[k])
{
//Intercambiar posiciones
int aux
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
//Ingresar por teclado los tiempos de cada competidor
Console.Write("Ingrese el numero de competidores: ");
int n = int.Parse(Console.ReadLine());
Console.Clear();
string[] nombres = new string[n];
int[] tiempos = new int[n];
for (int i = 0; i < tiempos.Length; i++)
{
Console.Write("Ingrese el nombre del competidor: ");
nombres[i] = Console.ReadLine();
Console.Write("Ingrese el tiempo del competidor: ");
tiempos[i] = int.Parse(Console.ReadLine());
}
def get_winner_list(times):
return sorted(times)
def get_ranking(times):
winners = get_winner_list(times)
return f"1st: {winners[0]}, 2nd: {winners[1]}, 3rd: {winners[2]}"
times = []
for index in range(1, 4):
time = input(f'Ingrese el tiempo del competidor {index}: ')
times.append(time)
get_ranking(times)
def add(a, b):
return a + b
add(1, 2)
static int[] sort(int[] arr)
{
int temp;
for (int i = 0; i < arr.Length; i++)
{
for (int j = 0; j < arr.Length - i - 1; j++)
{
if (arr[j] < arr[j + 1])
{
temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
return arr;
}
public static void Club_de_atletismo() {
int cantidad = int.Parse(Console.ReadLine());
int[] tiempos = new int[cantidad];
int[] puntajes = new int[3] {3, 2, 1};
int cont = 0;
while (cont < cantidad) {
Console.WriteLine("Ingrese el tiempo del competidor: ");
tiempos[cont] = int.Parse(Console.ReadLine());
cont++;
}
Array.Sort(tiempos);
Array.Reverse(tiempos);
Console.WriteLine("Primer puesto: " + tiempos[0] + " con puntaje " + puntajes[0]);
Console.WriteLine("Segundo puesto: " + tiempos[1] + " con puntaje " + puntajes[1]);
Console.WriteLine("Tercer puesto: " + tiempos[2] + " con puntaje " +
class Program
{
static void Main(string[] args)
{
int cantidad = 0;
double tiempo = 0;
double[] tiempos = new double[0];
int i = 0;
Console.WriteLine("Cantidad de competidores");
cantidad = Convert.ToInt32(Console.ReadLine());
tiempos = new double[cantidad];
for (int i = 0; i < cantidad; i++)
{
Console.WriteLine("Ingrese el tiempo del competidor {0}", i + 1);
tiempos[i] = Convert.ToDouble(Console.ReadLine());
}
Array.Sort(tiempos);
for (int i = (cantidad - 1); i >= (cantidad - 3); i--)
{
Console.WriteLine("{0} puesto: {1}", cantidad - i, tiempos[i]);
}
}
}
float cal_prom = 0;
int cantidad = 0;
int cont = 1;
string nombre = "";
float nota = 0;
double promedio = 0;
Console.WriteLine("Escribe la cantidad de estudiantes a valorar");
cantidad = int.Parse(Console.ReadLine());
while (cont <= cantidad)
{
Console.WriteLine("Escribe el nombre del estudiante");
nombre = Console.ReadLine();
Console.WriteLine("Escribe la nota del estudiante");
nota = float.Parse(Console.ReadLine());
while (nota < 10)
{
Console.WriteLine("Escribe la nota del estudiante");
nota = float.Parse(Console.ReadLine());
}
cont++;
cal_prom += nota;
}
promedio = cal_prom / cantidad;
Console.WriteLine("El promedio
string[] competidores = { "Pedro", "Juan", "José", "Jorge", "Fernanda", "Maria", "Ana", "Lucia", "Rebeca", "Andrés", "Miguel", "Diego", "Mauricio", "Bruno", "Luis", "Javier", "Gerardo", "Daniel", "Camilo", "Esteban" };
int[] puntaje = { 10, 7, 5, 3, 2, 1 };
int[] tiempo = new int[20];
int aux = 0;
int aux1 = 0;
char c = 'S';
int j = 0;
Console.WriteLine("Ingrese el numero de competidores");
int n = int.Parse(Console.ReadLine());
if (n > 20)
{
Console.WriteLine("El maximo de competidores es 20");
}
else
{
Console.WriteLine("Seleccione los competidores con los que quiera participar");
for (int i = 0; i
string[] nombre = new string[] {"Juan", "Maria", "Pedro"};
int[] puntuacion = new int[] {3, 5, 1};
Array.Sort(puntuacion, nombre);
numeroEstudiantes = int(input("Ingrese la cantidad de estudiantes: "))
sumaNotas = 0
for i in range(numeroEstudiantes):
nombre = input("Ingrese el nombre del estudiante: ")
nota = float(input("Ingrese la nota del estudiante: "))
if nota < 10:
nota = float(input("Ingrese una nota mayor o igual a 10: "))
sumaNotas += nota
promedio = sumaNotas / numeroEstudiantes
print("El promedio de las notas es: " + str(promedio))
#include <iostream>
#include <time.h>
#include <stdlib.h>
using namespace std;
const int n_competidores = 5;
void inicializar_array(int v[], int n);
int num_aleatorio(int n);
void crear_array(int v[], int n);
void mostrar_array(int v[], int n);
void mostrar_ganador(int v[], int n);
void mostrar_primeros(int v[], int n);
void mostrar_segundos(int v[], int n);
void mostrar_terceros(int v[], int n);
int main() {
int competidores[n_competidores];
inicializar_array(competidores, n_competidores);
crear_array(competidores, n_competidores);
mostrar_array(competidores, n_competidores);
mostrar_
def get_times(race_results):
# Obtener los tres mejores tiempos
fastest_three = # rellenar con código
primer_puesto = fastest_three[0]
segundo_puesto = fastest_three[1]
tercer_puesto = fastest_three[2]
# imprimir mensajes
print('primer puesto: ' + str(primer_puesto) + ' segundos')
print('segundo puesto: ' + str(segundo_puesto) + ' segundos')
print('tercer puesto: ' + str(tercer_puesto) + ' segundos')
race_times = [21.53, 21.52, 22.5, 23.56, 24.12, 24.2, 24.8]
get_times(race_times)
static void Main(string[] args)
{
Console.WriteLine("Ingrese el numero de competidores");
int n = int.Parse(Console.ReadLine());
int[] tiempo = new int[n];
for (int i = 0; i < n; i++)
{
Console.WriteLine("Ingrese el tiempo del competidor {0}", i + 1);
tiempo[i] = int.Parse(Console.ReadLine());
}
for (int i = 0; i < n - 1; i++)
{
for (int j = 0; j < n - i - 1; j++)
{
if (tiempo[j] > tiempo[j + 1])
{
int aux = tiempo[j];
tiempo[j] = tiempo[j + 1];
tiempo[j + 1] = aux;
}
}
}
Console.WriteLine("El primer
using System;
public class Program
{
public static void Main()
{
int cantidadEmpleados = 0;
Console.WriteLine("Digite la cantidad de Empleados");
cantidadEmpleados = int.Parse(Console.ReadLine());
Person[] employees = new Person[cantidadEmpleados];
int[] edades = new int[cantidadEmpleados];
int[] meses = new int[12];
for (int i = 0; i < cantidadEmpleados; i++)
{
Console.WriteLine("Digite la fecha de nacimiento del empleado " + (i + 1));
employees[i] = new Person(Console.ReadLine());
edades[i] = employees[i].getEdad();
}
double promedioEdad = 0;
for (int i = 0; i < cantidadEmpleados; i++)
{
promedioEdad = promedioEdad + edades[i];
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3
{
class Program
{
static void Main(string[] args)
{
List<Empleado> empleados = new List<Empleado>();
empleados.Add(new Empleado("Juan"));
empleados.Add(new Empleado("Juan"));
empleados.Add(new Empleado("Juan"));
empleados.Add(new Empleado("Juan"));
empleados.Add(new Empleado("Juan"));
int promedio = 0;
for (int i = 0; i < empleados.Count; i++)
{
Console.WriteLine("Ingrese la edad del empleado " + i + ": ");
int age = int.Parse(Console.ReadLine());
empleados[i].
int numEstudiantes = 0;
int contador = 0;
float sumaNotas = 0;
float promedio = 0;
String nombre = "";
float nota = 0;
Console.WriteLine("Bienvenido al programa");
Console.WriteLine("Ingrese la cantidad de estudiantes");
numEstudiantes = int.Parse(Console.ReadLine());
//Mientras la cantidad de estudiantes sea mayor o igual a 0
while(numEstudiantes >= 0){
Console.WriteLine("Ingrese el nombre del estudiante");
nombre = Console.ReadLine();
Console.WriteLine("Ingrese la nota del estudiante");
nota = float.Parse(Console.ReadLine());
//Condicion nota no puede ser menor a 10
if (nota < 10){
Console.WriteLine("La nota no puede ser menor a 10");
} else {
sum
void Main()
{
Console.WriteLine("Ingrese el numero de competidores");
int competidores = Convert.ToInt32(Console.ReadLine());
List<TimeSpan> times = new List<TimeSpan>();
for (int i = 0; i < competidores; i++)
{
Console.WriteLine("Ingrese los tiempos del competidor {0}", i);
times.Add(TimeSpan.Parse(Console.ReadLine()));
}
times.Sort();
Console.WriteLine("Primer Puesto: {0}", times[0]);
Console.WriteLine("Segundo Puesto: {0}", times[1]);
Console.WriteLine("Tercer Puesto: {0}", times[2]);
}
int competidores = 0;
float primerPuesto = 0, segundoPuesto = 0, tercerPuesto = 0;
Console.Write("Ingrese la cantidad de competidores: ");
competidores = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("");
float[] tiempos = new float[competidores];
for (int i = 0; i < competidores; i++)
{
Console.Write("Ingrese el tiempo del competidor {0}: ", i + 1);
tiempos[i] = Convert.ToSingle(Console.ReadLine());
}
primerPuesto = tiempos[0];
segundoPuesto = tiempos[0];
tercerPuesto = tiempos[0];
for (int i = 1; i < competidores; i++)
{
if (tiempos[i