int[,] num = {{ 16, 22, 99, 4, 18 },{ -258, 4, 101, 5, 98 },{ 105, 6, 15, 2, 45 },{ 33, 88, 72, 16, 3 }};
int Mayor = num[0, 0];
int posR = 0, posC = 0, R, C;
for (R = 0; R <4; R++)
{
for (C = 0; C <5 ; C++)
{
if (num[R, C] > Mayor)
{
posR = R;
posC = C;
Mayor = num[R, C];
}
}
}
for (R = 0; R < 4; R++)
{
for (C = 0; C < 5; C++)
{
print num[R, C]);
}
print Mayor
print posR+1
print posC+1
FIN
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PRACTICA_11_1C
{
class Program
{
static void Main(string[] args)
{
int[,] num = {{ 16, 22, 99, 4, 18 },{ -258, 4, 101, 5, 98 },{ 105, 6, 15, 2, 45 },{ 33, 88, 72, 16, 3 }};
int Mayor = num[0, 0];
int posR = 0, posC = 0, R, C;
for (R = 0; R <4; R++)
{
for (C = 0; C <5 ; C++)
{
if (num[R, C] > Mayor)
{
posR = R;
posC = C;
Mayor = num[R, C];
}
}
}
for (R = 0; R < 4; R++)
{
for (C = 0; C < 5; C++)
{
Console.Write("\t{0}", num[R, C]);
}
Console.WriteLine();
}
Console.WriteLine("El dato mayor es: {0}", Mayor);
Console.WriteLine("En el renglon: {0}", posR+1);
Console.WriteLine("Y la columna: {0}", posC+1);
Console.ReadKey();
}
}
}
![[p11.1.jpg]](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6kXJWh-4m9EgQoHGh5JZcmiN8fDBbsN1ogDhu5ecVZTEYArPEYWA-RclBYfPf-g93eNu8gVmiWvApDCErNdB3upqMkrpym-Oomz2UMOuSTNF-wHHMqdqcwRX1LOnBA0CLNy0yN_9tX3An/s1600/p11.1.jpg)

No hay comentarios:
Publicar un comentario