using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace bt_15
{
class Program
{
static int h, c, i, j;
static int[,] a;
static void nhap()
{
Console.Write("nhap so hang h="); h = int.Parse(Console.ReadLine());
Console.Write("nhap so cot c="); c = int.Parse(Console.ReadLine());
a = new int[h, c];
Console.WriteLine("nhap cac phan tu trong mang");
for (i = 0; i < h; i++)
for (j = 0; j < c; j++)
{
Console.Write("a[{0},{1}]=", i, j);
a[i, j] = int.Parse(Console.ReadLine());
Console.WriteLine();
}
}
static void hien()
{
Console.WriteLine("mang vua nhap la");
for (i = 0; i < h; i++)
{
for (j = 0; j < c; j++)
Console.Write(a[i, j] + "\t");
Console.WriteLine();
}
}
static void shh()
{
float s=0;
for (i = 0; i < h; i++)
for (j = 0; j < c; j++)
{
for (int k = 1; k < a[i, j]; k++)
{
if (a[i, j] % k == 0)
s = s + k;
}
if (a[i, j] == s && a[i, j] > 1)
Console.Write(a[i, j] + "\t");
}
}
static void Main(string[] args)
{
nhap();
hien();
shh();
Console.ReadKey();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace bt_15
{
class Program
{
static int h, c, i, j;
static int[,] a;
static void nhap()
{
Console.Write("nhap so hang h="); h = int.Parse(Console.ReadLine());
Console.Write("nhap so cot c="); c = int.Parse(Console.ReadLine());
a = new int[h, c];
Console.WriteLine("nhap cac phan tu trong mang");
for (i = 0; i < h; i++)
for (j = 0; j < c; j++)
{
Console.Write("a[{0},{1}]=", i, j);
a[i, j] = int.Parse(Console.ReadLine());
Console.WriteLine();
}
}
static void hien()
{
Console.WriteLine("mang vua nhap la");
for (i = 0; i < h; i++)
{
for (j = 0; j < c; j++)
Console.Write(a[i, j] + "\t");
Console.WriteLine();
}
}
static void shh()
{
float s=0;
for (i = 0; i < h; i++)
for (j = 0; j < c; j++)
{
for (int k = 1; k < a[i, j]; k++)
{
if (a[i, j] % k == 0)
s = s + k;
}
if (a[i, j] == s && a[i, j] > 1)
Console.Write(a[i, j] + "\t");
}
}
static void Main(string[] args)
{
nhap();
hien();
shh();
Console.ReadKey();
}
}
}