121

3
333333 // Variables del programa y asignar valores // Variables del programa y asignar valores int Numero, N, MINUTOS, SEGUNDOS, HORAS, TIEMPO=0; int MENOR = 1000000000, VUELTA = 0; // Leer variables Console.Write("Ingrese el valor de N :"); N = int.Parse(Console.ReadLine()); // Determinar cantidad de notas validad y no validas Numero = 1; MENOR = 1000000000; VUELTA = 0; while (Numero <= N) { Console.WriteLine("Ingrese HORAS : "); HORAS = int.Parse(Console.ReadLine()); Console.WriteLine("Ingrese MINUTOS : "); MINUTOS = int.Parse(Console.ReadLine()); Console.WriteLine("Ingrese SEGUNDOS : "); SEGUNDOS = int.Parse(Console.ReadLine()); TIEMPO = SEGUNDOS + MINUTOS * 60 + HORAS * 3600; if (TIEMPO < MENOR) { MENOR = TIEMPO; VUELTA = Numero; } Numero = Numero + 1; } HORAS = MENOR / 3600; MINUTOS = MENOR / 60 - HORAS;

Upload: josue-patilla-espinoza

Post on 19-Dec-2015

213 views

Category:

Documents


0 download

DESCRIPTION

.....

TRANSCRIPT

Page 1: 121

333333

// Variables del programa y asignar valores // Variables del programa y asignar valores int Numero, N, MINUTOS, SEGUNDOS, HORAS, TIEMPO=0; int MENOR = 1000000000, VUELTA = 0; // Leer variables

Console.Write("Ingrese el valor de N :"); N = int.Parse(Console.ReadLine()); // Determinar cantidad de notas validad y no validas

Numero = 1; MENOR = 1000000000; VUELTA = 0;

while (Numero <= N) { Console.WriteLine("Ingrese HORAS : ");

HORAS = int.Parse(Console.ReadLine());

Console.WriteLine("Ingrese MINUTOS : ");

MINUTOS = int.Parse(Console.ReadLine());

Console.WriteLine("Ingrese SEGUNDOS : "); SEGUNDOS = int.Parse(Console.ReadLine());

TIEMPO = SEGUNDOS + MINUTOS * 60 + HORAS * 3600;

if (TIEMPO < MENOR) {

MENOR = TIEMPO; VUELTA = Numero; }

Numero = Numero + 1; }

HORAS = MENOR / 3600;

MINUTOS = MENOR / 60 - HORAS; SEGUNDOS = MENOR - HORAS - MINUTOS;

// Mostrar los resultados

Console.WriteLine("El Nro. DE horas ES:{0:f0} ", HORAS); Console.WriteLine("El Nro. DE MINUTOS ES:{0:f0} ", MINUTOS); Console.WriteLine("El Nro. DE segundos ES:{0:f0} ", SEGUNDOS);

Page 2: 121

Console.ReadKey();

2222222222222

//Declarar variables int Numero, x; int pares = 0, impares = 0; //Leer variables Console.Write("Ingrese el numero :"); Numero = int.Parse(Console.ReadLine()); //Proceso

while (Numero > 0) { x = Numero % 10;

if ((x % 2) == 0) { pares++; } else { impares++; }

Numero = Numero / 10; } //Mostrar los resultados

Console.WriteLine("los numeros pares son: "); Console.WriteLine(pares); Console.WriteLine("los numeros impares son: "); Console.WriteLine(impares);

Console.ReadKey();