Sub Ìàêðîñ1() Dim Sum(heigth - 1, width - 1) Dim Product(heigth - 1, width - 1)
For i = 0 To heigth - 1 For j = 0 To width - 1 Sum(i, j) = i + j Product(i, j) = i * j Next j Next i
Call Show(Sum, 0, 0) Call Show(Product, 0, 12) End Sub
Sub Show(ByRef m, dx, dy) For i = 0 To heigth - 1 For j = 0 To width - 1 ActiveSheet.Cells(dx + i + 1, dy + j + 1).Value = Hex(m(i, j)) Next j Next i End Sub
Using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace ConsoleApplication5 { class Program { static void Main(string[] args) { // 1) Написать программу,которая вводит таблицу квадратов первых 10 чисел. for (int i = 1; i <= 10; i++) { Console.WriteLine(i + "^2=" + Math.Pow(i, 2)); }
Console.ReadKey();
// 2) Найти все натуральные числа а,b,с, из интервала от 1 до 10 для которых выполняется равенство а^2+b^2=c^2
for (int a = 1; a <= 10; a++) { for (int b = 1; b <= 10; b++) { for (int c = 1; c <= 10; c++) { if (Math.Pow(a, 2) + Math.Pow(b, 2) == Math.Pow(c, 2)) Console.WriteLine("a=" + a + "; b=" + b + "; c="+c); } } }