lunes, 20 de octubre de 2008

Practica 5

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int n, m, r, c;
double suma = 0;
string[] nombres;
double[,] notas;

Console.WriteLine("introduce el numero de alumnos a registrar");
n = int.Parse(Console.ReadLine());

Console.WriteLine("Introduce el numero de calificaciones a registrar por cada alumnno");
m = int.Parse(Console.ReadLine());

nombres = new string[n];
notas = new double [n,m];
Console.WriteLine("Introduce los siguientes datos");

for (r=0; r < n; r++)
{
Console.WriteLine("Nombre Alumno {0}", r + 1);
nombres[r]= Console.ReadLine();

for (c=0; c < m; c++)
{
Console.WriteLine("Calificacion{0}", c + 1);
}
}

Console.WriteLine("Nombre del Alumno Calificaciones Promedio");
Console.WriteLine("----");

for (r=0; r < n; r++)
{
Console.Write("{0}", nombres[r]);
suma = 0.0;
for (c=0; c < m; c++)
{
Console.Write("\t{0}", notas[r, c]);
suma = suma + notas [r, c];
}
Console.WriteLine("\t\t\t {0}", suma / m);
}
Console.ReadLine();
}

}
}