Documente Academic
Documente Profesional
Documente Cultură
TRABAJO DE PROGRAMACIN
1. Leer 5 nmeros e imprimir la suma de ellos.
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int A, B, C, D, E, R;
//DECLARO LAS 6 VARIABLES, 5 ENTEROS SUMA Y RESPUESTA
Console.WriteLine("Bienvenidos ingrese 5 numeros");
//IMPRIMO EN LA PANTALLA EL MENSAJE INICIAL
A = Convert.ToInt32(Console.ReadLine());
//ASIGNO UN NUMERO A "A"
Console.WriteLine("Ingrese el siguiente numero");
B = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Ingrese el siguiente numero");
C = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Ingrese el siguiente numero");
D = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Ingrese el siguiente numero");
E = Convert.ToInt32(Console.ReadLine());
R = A + B + C + D + E;
//REALIZO LA SUMA
Console.WriteLine("EL RESULTADO ES {0}", R);
//IMPRIMO EL REUSLTADO DE LA SUMA
Console.Read();
//LEO LAS VARIABLES Y EL RESULTADO
}
}
}
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace EJERCICIO_N2
{
class Program
{
static void Main(string[] args)
{
int i;
02-FEB-2012
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int a = 10;
// DEFINO LA VARIABLE Y LE ASIGNO EL NUMERO DE ENTEROS A SUMAR
int b;
// DEFINO UNA VARIABLE PARA APLICAR LA FORMULA (RESP = (N*(N + 1))/2) QUE
AYUDARA A RESOLVER EL PROBLEMA
string resp;
//El tipo string representa una secuencia de cero o ms caracteres
b = (a*(a + 1))/2;
// APLICO LA FORMULA PARA OBTENER LA SUMA DE ENTEROS
resp = Convert.ToString(b);
Console.WriteLine("LA SUMA DE LOS PRIMEROS 10 NUMEROS NATURALES ES: "
+ resp);
// IMPRIMO EL RESULTADO
Console.Read();
// LEO LO IMPRESO
}
}
}
4. Dado un valor entero (X), mayor que cero (0). Imprimir por pantalla el
resultado de multiplicar a cada uno de sus antecesores por 2.
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
02-FEB-2012
5. Dado dos valores enteros (X) y (Y) ambos mayores que cero (0), contar la
cantidad de un nmero que haya dentro de ese rango de valores
determinados por (X) y (Y).
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int A, B, J, K, RANGO;
Console.WriteLine("Ingrese dos numeros");
A = Convert.ToInt32(Console.ReadLine());
02-FEB-2012
02-FEB-2012
System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EJERCICIO_7
{
class Program
{
static void Main(string[] args)
{
int COUNT = 0;
double SUM = 0;
double NUM;
double prom;
Console.WriteLine("INGRESE EL CERO PARA TERMINAR");
Console.WriteLine(" ");
do
{
Console.WriteLine("INGRESE UNA CANTIDAD");
double n = int.Parse(Console.ReadLine());
SUM = SUM + n;
COUNT = COUNT + 1;
NUM = n;
}
while (NUM != 0);
prom = (double) SUM / (COUNT - 1);
Console.WriteLine("EL PROMEDIO ES: " + prom);
Console.ReadLine();
}
}
}
8. Dado un valor entero (Y) , mayor que cero (0), contar cuantos nmeros
pares y cuantos nmeros impares existen dentro de ese rango.
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace ConsoleApplication1
{
class Program
{
02-FEB-2012
}
}
Console.WriteLine
("existen " + contimp + " numeros impares en el rango");
Console.WriteLine
("existen " + contpar + " numeros pares en el rango");
Console.ReadLine();
}
}
02-FEB-2012
02-FEB-2012
11. Imprimir y contar los nmeros que son mltiplos de 2 o 3 que hay
entre 1 y 100.
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace Ejerc_11
{
class Program
{
static void Main(string[] args)
{
int[] NUMS = new int[5];
for (int x = 0; x <= 4; x++)
NUMS[x] = 0;
for (int x = 0; x <= 4; x++)
{
Console.WriteLine("INGRESE UN DIGITO PARA ALMACENARLO");
NUMS[x] = int.Parse(Console.ReadLine());
}
Console.WriteLine("LOS NUMEROS PRIMOS SON: ");
for (int x = 0; x <= 4; x++)
{
int CONTADOR = 1;
int FCT = 1;
if (NUMS[x] >= 1)
{
do
{
FCT = FCT * CONTADOR;
CONTADOR++;
}
while (CONTADOR < NUMS[x]);
if ((FCT + 1) % NUMS[x] == 0)
Console.WriteLine(NUMS[x]);
}
}
Console.ReadLine();
}
}
}
02-FEB-2012
12. Hacer un seudocdigo que imprima los nmeros del 1 al 100. Que
calcule la suma de todos los nmeros pares por un lado, y por otro, la de
todos los impares.
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int CONT, K, SUMA, X;
X = 1;
SUMA = 0;
CONT = 0;
K = 1;
Console.WriteLine("LOS NUMEROS DEL 1 AL 100 SON");
while (X <= 100)
{
Console.WriteLine(X);
X = X + 1;
}
while (CONT <= 100)
{
SUMA = SUMA + CONT;
CONT = CONT + 2;
}
Console.WriteLine("LA SUMA DE TODOS LOS PARES DEL 1 AL 100 ES "+SUMA);
while (K <= 100)
{
SUMA = SUMA + K;
02-FEB-2012
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int N, CONT, Z;
Console.WriteLine("INGRESE UN NUMERO");
N = Int32.Parse(Console.ReadLine());
CONT = 0;
Z = 0;
Console.WriteLine
("LOS MULTIPLOS DE 3 DESDE LA UNIDAD HASTA EL NUMERO INGRESADO
SON");
while (CONT < (N - 2))
{
Z = Z + 1;
CONT = CONT + 3;
Console.WriteLine(CONT);
}
Console.WriteLine("HAY "+Z+" MULTIPLOS DE 3");
Console.ReadLine();
}
}
}
02-FEB-2012
14. Imprimir, contar y sumar los mltiplos de 2 que hay entre una serie
de nmeros, tal que el segundo sea mayor o igual que el primero.
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int a, b, suma, j, z, x;
Console.WriteLine("INGRESE UN NUMERO MENOR");
a = Int32.Parse(Console.ReadLine());
Console.WriteLine("INGRESE UN NUMERO MAYOR");
b = Int32.Parse(Console.ReadLine());
suma = 0;
j = 0;
Console.WriteLine();
if (a <= b)
{
Console.WriteLine("LOS NUMEROS DENTRO DEL RANGO SON: ");
Console.WriteLine();
x = a;
while (a < b - 1)
{
a = a + 1;
Console.WriteLine(a);
}
while (x < b - 1)
{
x = x + 1;
z = x % 2;
if (z == 0)
{
Console.WriteLine
("LOS MULTIPLOS DE 2 EN LA SERIE SON " + x);
j = j + 1;
suma = suma + x;
}
}
Console.WriteLine();
Console.WriteLine
("LA SUMA DE LOS MULTIPLOS DE 2 EN LA SERIE SON " + suma);
Console.WriteLine();
Console.WriteLine
(" Y EXISTEN " + j + " MULTIPLOS DE 2 EN ESTA SERIE");
02-FEB-2012
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int a, b, c, x, z, j;
Console.WriteLine("INGRESAR HORAS");
a = Int32.Parse(Console.ReadLine());
Console.WriteLine("INGRESAR MINUTOS");
b = Int32.Parse(Console.ReadLine());
Console.WriteLine("INGRESAR SEGUNDOS");
c = Int32.Parse(Console.ReadLine());
for (x = a; x <= 23; x++)
{
for (z = b; z <= 59; z++)
{
for (j = c; j <= 59; j++) ;
Console.WriteLine(x + ":" + z + ":" + j);
}
}
Console.ReadLine();
}
}
}
02-FEB-2012
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace EJERCICIO_16
{
class Program
{
static void Main(string[] args)
{
int[] SEC = new int[5];
int SUM = 0;
int MULT = 1;
for (int a = 0; a <= 4; a++)
{
SEC[a] = 0;
}
for (int a = 0; a <= 4; a++)
{
Console.WriteLine("INGRESE NUMEROS ENTEROS");
SEC[a] = int.Parse(Console.ReadLine());
}
for (int a = 0; a <= 4; a++)
{
if (SEC[a] % 2 == 0)
SUM = SUM + SEC[a];
if (SEC[a] % 5 == 0)
MULT = MULT * SEC[a];
}
Console.WriteLine("");
Console.WriteLine("EL PRODUCTO DE LOS MULTIPLOS DEL CINCO ES:" + MULT);
Console.WriteLine("");
Console.WriteLine("LA SUMA DE LOS PARES ES: " + SUM);
Console.ReadLine();
}
}
}
02-FEB-2012
17.
Leer una secuencia de nmeros y determinar el mayor de los pares
ledos.
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace EJERCICIO_17
{
class Program
{
static void Main(string[] args)
{
int[] SEC = new int[5];
for (int a = 0; a <= 4; a++)
{
SEC[a] = 0;
}
for (int a = 0; a <= 4; a++)
{
Console.WriteLine("INGRESE UN NUMERO ENTERO");
SEC[a] = int.Parse(Console.ReadLine());
}
int MAY = SEC[0];
for (int a = 0; a <= 4; a++)
{
if ((SEC[a] % 2 == 0) & (SEC[a] > MAY))
MAY = SEC[a];
}
if (MAY != SEC[0])
{
Console.WriteLine(" ");
Console.WriteLine("EL NUMERO PAR MAYOR ES EL: " + MAY);
Console.ReadLine();
}
else
{
if (MAY % 2 == 0)
{
Console.WriteLine(" ");
Console.WriteLine("EL NUMERO PAR MAYOR ES EL: " + MAY);
Console.ReadLine();
}
else
{
Console.WriteLine("NO EXISTEN NUMEROS PARES");
Console.ReadLine();
}
}
02-FEB-2012
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace EjJERCICO_18
{
class Program
{
static void Main(string[] args)
{
int[] secu = new int[10];
for (int a = 0; a <= 9; a++)
secu[a] = 0;
for (int a = 0; a <= 9; a++)
{
Console.WriteLine("INGRESE UN NUMERO ENTERO");
secu[a] = int.Parse(Console.ReadLine());
}
int myr = secu[0];
int mnr = secu[1];
for (int a = 0; a <= 9; a++)
{
if ((secu[a] % 5 == 0) & (secu[a] > myr))
myr = secu[a];
if ((secu[a] % 3 == 0) & (secu[a] < mnr))
mnr = secu[a];
}
if ((myr != secu[0]) & (mnr != secu[1]))
{
Console.WriteLine
("EL NUMERO MAYOR Y MULTIPLO DE CINCO ES: " + myr);
Console.WriteLine
("EL NUMERO MENOR Y MULTIPLO DE TRES ES: " + mnr);
Console.ReadLine();
}
if ((myr != secu[0]) & (mnr == secu[1]))
{
Console.WriteLine
("EL NUMERO MAYOR Y MULTIPLO DE CINCO ES: " + myr);
if (mnr % 3 == 0)
{
Console.WriteLine
("EL NUMERO MENOR Y MULTIPLO DE TRES ES: " + mnr);
Console.ReadLine();
}
else
02-FEB-2012
}
}
if ((myr == secu[0]) & (mnr != secu[1]))
{
if (myr % 5 == 0)
Console.WriteLine
("EL NUMERO MAYOR Y MULTIPLO DE CINCO ES: " + myr);
else
Console.WriteLine("NO HAY MULTIPLOS DE CINCO");
Console.WriteLine
("EL NUMERO MENOR Y MULTIPLO DE TRES ES: " + mnr);
Console.ReadLine();
}
if ((myr == secu[0]) & (mnr == secu[1]))
{
if (myr % 5 == 0)
Console.WriteLine
("EL NUMERO MAYOR Y MULTIPLO DE CINCO ES: " + myr);
else
Console.WriteLine("NO HAY MULTIPLOS DE CINCO");
if (mnr % 3 == 0)
{
Console.WriteLine
("EL NUMERO MENOR Y MULTIPLO DE TRES ES: " + mnr);
Console.ReadLine();
}
else
{
Console.WriteLine("NO HAY MULTIPLOS DE TRES");
Console.ReadLine();
}
}
}
19.
Leer una secuencia de letras y mostrar la suma de sus cdigos ASCII.
Suponemos que tenemos la funcin Conv_a_Codigo (char)=int.
20. Dado un vector de 5 enteros actualizar cada posicin de dicho vector
con un nmero ledo.
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
02-FEB-2012
while (i < 6)
{
vect[i] = i;
Console.WriteLine
("NUMERO INGRESADO AL VECTOR EN LA POSICION: " + i);
Console.WriteLine(vect[i]);
i++;
}
Console.WriteLine("");
for (i = 1; i < 6; i++)
{
Console.WriteLine
("INGRESE EL NUEVO NUMERO PARA LA POSICION: " + i);
n = int.Parse(Console.ReadLine());
vect[i] = n;
}
Console.WriteLine("");
for (i = 1; i < 6; i++)
{
Console.WriteLine
("EL NUEVO NUMERO INGRESADO EN LA POSICION: " + i + " ES " + vect[i]);
}
Console.ReadLine();
}
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace EJERCICIO_21
{
class Program
{
02-FEB-2012
22.
Dado dos vectores A y B de 15 elementos cada uno, obtener un
vector C donde la posicin i se almacene la suma de A[i]+B[i].
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace EJERCICIO_22
{
class Program
{
static void Main(string[] args)
{
int[] A = new int[16];
int[] B = new int[16];
int[] sumaAB = new int[16];
int n;
02-FEB-2012
23.
Dado dos vectores A y B de 15 elementos cada uno, obtener un
vector C donde la posicin i se almacene la suma de A[i]+B[i] y mostrar
el mayor de los C[i].
FREDDY GUZMAN ALARCON
02-FEB-2012
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace EJERCICIO_23
{
class Program
{
static void Main(string[] args)
{
int[] A = new int[16];
int[] B = new int[16];
int[] sumaAB = new int[16];
int n;
int i;
int mayor1;
int mayor2;
//Para encerar lo vectores
for (i = 1; i < 16; i++)
{
A[i] = 0;
B[i] = 0;
sumaAB[i] = 0;
}
Console.WriteLine("VECTOR A");
for (i = 1; i < 16; i++)
{
Console.Write
("Ingrese un numero a la posicion[" + i + "] del vector A:");
n = int.Parse(Console.ReadLine());
A[i] = n;
}
Console.WriteLine("VECTOR B");
// para ingresar valores del vector B
for (i = 1; i < 16; i++)
{
Console.Write
("Ingrese un numero a la posicion[" + i + "] del vector B:");
n = int.Parse(Console.ReadLine());
B[i] = n;
}
for (i = 1; i < 16; i++)
{
sumaAB[i] = A[i] + B[i];
}
Console.WriteLine("RESULTADO VECTOR C");
for (i = 1; i < 16; i++)
{
Console.WriteLine
("La Suma de A y B en la posicion " + i + " es: " + sumaAB[i]);
}
{
if (sumaAB[1] > sumaAB[2])
{
mayor1 = sumaAB[1];
mayor2 = sumaAB[2];
}
else
{
mayor1 = sumaAB[2];
mayor2 = sumaAB[1];
02-FEB-2012
24.
Dado una secuencia de nmero ledos y almacenados en un vector A
mostrar dichos nmeros en orden.
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace EJERCICO_24
{
class Program
{
static void Main(string[] args)
{
int[] num = new int[8];
for (int a = 0; a <= 7; a++)
num[a] = 0;
for (int a = 0; a <= 7; a++)
{
Console.WriteLine("INGRESE UN NUMERO AL VECTOR");
num[a] = int.Parse(Console.ReadLine());
}
for (int a = 0; a <= 7; a++)
for (int b = a + 1; b <= 7; b++)
if (num[a] > num[b])
02-FEB-2012
}
}
}
Console.WriteLine("EL VECTOR ORDENADO ES:");
for (int a = 0; a <= 7; a++)
Console.Write(num[a] + ", ");
Console.ReadLine();
25.
Leer una secuencia de 20 nmeros y almacenar en un vector sus
factoriales.
26.
Leer 20 nmeros y almacenarlos de manera ordenada en un vector.
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace EJERCICIO_26
{
class Program
{
static void Main(string[] args)
{
int[] nums = new int[20];
int[] vct = new int[20];
for (int x = 0; x <= 19; x++)
nums[x] = 0;
Console.WriteLine
("INGRESE 20 NUMEROS PARA ALMACENAR Y ORDENAR EN UN VECTOR: ");
Console.WriteLine(" ");
for (int x = 0; x <= 19; x++)
{
Console.Write
("INGRESE EL NUMERO PARA LA POSICION " + x + " DEL VECTOR:");
Console.Write(" ");
nums[x] = int.Parse(Console.ReadLine());
}
for (int x = 0; x <= 19; x++)
for (int y = x + 1; y <= 19; y++)
if (nums[x] > nums[y])
{
int aux = nums[x];
nums[x] = nums[y];
nums[y] = aux;
}
02-FEB-2012
}
}
Console.Write(" ");
Console.WriteLine("LOS NUMEROS EN ORDEN CRECIENTE SON:");
for (int x = 0; x <= 19; x++)
vct[x] = nums[x];
for (int x = 0; x <= 19; x++)
Console.Write(vct[x] + ", ");
Console.ReadLine();
27.
using
using
using
using
namespace matriz
{
class Program
{
static void Main(string[] args)
{
//declaracin d ela matriz
int[,] mata;
int[,] matb;
int[,] matc;
int m, n;
Console.WriteLine("Cual es la dimensin de la matriz?");
Console.Write("Ingrese la primera dimensin: ");
m = Int32.Parse(Console.ReadLine());
Console.Write("Ingrese la segunda dimensin: ");
n = Int32.Parse(Console.ReadLine());
mata = new int[m, n];
matb = new int[m, n];
matc = new int[m, n];
if (m == n)
{
//encerar matriz
for (int i = 0; i < m; i++) //manejo de filas
for (int j = 0; j < n; j++) //manejo de columnas
{
mata[i, j] = 0;
matb[i, j] = 0;
matc[i, j] = 0;
}
//ingreso de datos
Console.WriteLine("Ingreso de los datos de la matriz A");
02-FEB-2012
28.
using
using
using
using
namespace EJERCICIO_29
{
class Program
{
static void Main(string[] args)
{
int[,] MTRZ = new int[4, 4];
for (int X = 0; X <= 3; X++)
for (int Y = 0; Y <= 3; Y++)
02-FEB-2012
}
}
MTRZ[X, Y] = 0;
for (int X = 0; X <= 3; X++)
for (int Y = 0; Y <= 3; Y++)
{
Console.WriteLine
("INGRESAR EL VALOR [" + (X + 1) + "," + (Y + 1) + "] DE LA MATRIZ");
MTRZ[X, Y] = int.Parse(Console.ReadLine());
}
int MAY = MTRZ[1, 1];
int POSIFILA = 1;
int POSICOLUM = 1;
for (int X = 0; X <= 3; X++)
for (int Y = 0; Y <= 3; Y++)
{
if (MTRZ[X, Y] >= MAY)
{
MAY = MTRZ[X, Y];
POSIFILA = X + 1;
POSICOLUM = Y + 1;
}
}
Console.WriteLine("LA POSICION DEL NUMERO MAYOR DE LA MATRIZ ES:");
Console.WriteLine("[" + POSIFILA + "," + POSICOLUM + "]");
Console.WriteLine("Y EL NUMERO ES: " + MAY);
Console.ReadLine();
29.
using
using
using
using
namespace EJERCICIO_30
{
class Program
{
static void Main(string[] args)
{
int[,] MTRZ = new int[2, 2];
for (int a = 0; a <= 1; a++)
for (int b = 0; b <= 1; b++)
MTRZ[a, b] = 0;
for (int a = 0; a <= 1; a++)
for (int b = 0; b <= 1; b++)
{
Console.WriteLine
("INGRESE EL VALOR [" + (a + 1) + "," + (b + 1) + "] DE LA MATRIZ");
MTRZ[a, b] = int.Parse(Console.ReadLine());
02-FEB-2012
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace EJERCICIO_31
{
class Program
02-FEB-2012
32.
using
using
using
using
namespace EJERCICIO_32
{
class Program
{
static void Main(string[] args)
{
int[,] MTRZ = new int[4, 5];
for (int X = 0; X <= 3; X++)
for (int Y = 0; Y <= 4; Y++)
MTRZ[X, Y] = 0;
for (int X = 0; X <= 3; X++)
for (int Y = 0; Y <= 4; Y++)
{
Console.Write
("INGRESE EL VALOR [" + (X + 1) + "," + (Y + 1) + "] DE LA MATRIZ: ");
MTRZ[X, Y] = int.Parse(Console.ReadLine());
}
for (int X = 0; X <= 3; X++)
02-FEB-2012
33. Dada una matriz A[1..4][1..5] realiza el proceso de ordenar solo por
filas.
34. Dado un vector de nmeros determina aquellos que sea primos.
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace EJERCICIO_35
{
class Program
{
static void Main(string[] args)
{
int[] NUMS = new int[5];
for (int x = 0; x <= 4; x++)
NUMS[x] = 0;
Console.WriteLine("PROGRAMA PARA ENCONTRAR NUMEROS PRIMOS");
Console.Write("");
for (int x = 0; x <= 4; x++)
{
Console.WriteLine(" INGRESE UN NUMERO PARA ALMACENARLO ");
NUMS[x] = int.Parse(Console.ReadLine());
}
Console.WriteLine("LOS NUMEROS PRIMOS ENCONTRADOS SON: ");
02-FEB-2012
}
}
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace EJERCICIO_35
{
class Program
{
static void Main(string[] args)
{
int[] scncia = new int[10];
Console.WriteLine
("INGRESE EL NUMERO QUE DESEA VER LAS VECES Q APARECE EN EL
VECTOR:");
int n = int.Parse(Console.ReadLine());
Console.WriteLine(" ");
for (int x = 0; x <= 9; x++)
scncia[x] = 0;
for (int x = 0; x <= 9; x++)
{
Console.WriteLine("INGRESE NUMEROS AL VECTOR");
scncia[x] = int.Parse(Console.ReadLine());
}
int contador = 0;
for (int x = 0; x <= 9; x++)
{
02-FEB-2012
}
}
}
Console.WriteLine(" ");
Console.WriteLine
("SU NUMERO APARECE " +contador + " VECES EN EL VECTOR");
Console.ReadLine();
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace EJERCICIO_38
{
class Program
{
static void Main(string[] args)
{
int n, mil, dec, cent, uni, rest, suma;
Console.WriteLine("Ingrese un numero de 4 cifras");
n = Int32.Parse(Console.ReadLine());
mil = n / 1000;
rest = n % 1000;
cent = rest / 100;
rest = rest % 100;
dec = rest / 10;
uni = rest % 10;
suma = mil + cent + dec + uni;
Console.WriteLine("La suma de las cifras del numero es " + suma);
Console.ReadLine();
}
02-FEB-2012
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace EJERCICIO_39
{
class Program
{
static void Main(string[] args)
{
int h1, m1, s1, h2, m2, s2, rest, segr;
Console.WriteLine("Ingrese la hora");
h1 = Int32.Parse(Console.ReadLine());
Console.WriteLine("Ingrese los minutos");
m1 = Int32.Parse(Console.ReadLine());
Console.WriteLine("Ingrese los segundos");
s1 = Int32.Parse(Console.ReadLine());
segr = 86400 - (h1 * 3600 + m1 * 60 + s1);
h2 = segr / 3600;
rest = segr % 3600;
m2 = rest / 60;
s2 = rest % 60;
Console.WriteLine("El tiempo para que culmine el dia es:");
Console.WriteLine("" + h2 + " , " + m2 + " , " + s2);
Console.ReadLine();
}
}
}
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace EJERCICIO_40
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("
ADICION DE HORAS
");
Console.WriteLine("Ingresando los datos de la primera");
int h1, m1, s1, h2, m2, s2, h3, m3, s3, tots, rest;
Console.WriteLine("");
Console.WriteLine("Ingrese la hora");
h1 = Int32.Parse(Console.ReadLine());
Console.WriteLine("Ingrese los minutos");
m1 = Int32.Parse(Console.ReadLine());
Console.WriteLine("Ingrese los segundos");
s1 = Int32.Parse(Console.ReadLine());
Console.WriteLine("");
02-FEB-2012
}
}
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace EJERCICIO_41
{
class Program
{
static void Main(string[] args)
{
double v1, v2, v3, vtot, com, sueldonet;
Console.WriteLine("CALCULO DEL SUELDO NETO DE UN VENDEDOR");
Console.WriteLine("");
Console.WriteLine("Ingrese el valor de las ventas");
Console.WriteLine("");
Console.WriteLine("VENTA 1");
v1 = double.Parse(Console.ReadLine());
Console.WriteLine("VENTA 2");
v2 = double.Parse(Console.ReadLine());
Console.WriteLine("VENTA 3");
v3 = double.Parse(Console.ReadLine());
vtot = v1 + v2 + v3;
com = 0.12 * vtot;
sueldonet = (double)250.00 + com;
Console.WriteLine("");
Console.WriteLine("El sueldo neto del vendevor es " + sueldonet);
02-FEB-2012
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace EJERCICIO_42
{
class Program
{
static void Main(string[] args)
{
double porcvar, porcemuj;
int muj, var, total;
Console.Write("Ingrese el numero de votos de mujeres: ");
muj = Int32.Parse(Console.ReadLine());
Console.Write("Ingrese el numero de votos de hombres: ");
var = Int32.Parse(Console.ReadLine());
total = var + muj;
porcemuj = (double)muj * 100 / total;
porcvar = (double)var * 100 / total;
Console.WriteLine("");
Console.WriteLine("El porcentaje masculino es: " + porcvar);
Console.WriteLine("El porcentaje femenino es: " + porcemuj);
Console.ReadLine();
}
}
02-FEB-2012
}
}
44. Se cuenta con los votos obtenidos por Juan, Pedro y Mara en una
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace EJERCICO_44
{
class Program
{
static void Main(string[] args)
{
int a, b, c, vmax, vt;
Console.WriteLine(" CONTEO AUTOMATICO DE VOTOS ");
Console.WriteLine("");
02-FEB-2012
Pedro y Maria");
Juan y Maria");
Juan y Maria");
los tres");
02-FEB-2012
02-FEB-2012