Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //#1
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication1
- {
- class Program
- {
- public static void PrintMatrix(int [,] a)
- {
- for (int i = 0; i < a.GetLength(0); i++)
- {
- for (int j = 0; j < a.GetLength(1); j++)
- Console.Write("{0,-7}", a[i, j]);
- Console.WriteLine();
- }
- }
- public static void Kelet(int[,] a)
- {
- for (int i = 0; i < a.GetLength(0); i++)
- for (int j = 0; j < a.GetLength(1); j++)
- {
- a[i, j] = int.Parse(Console.ReadLine());
- }
- }
- static void Main(string[] args)
- {
- int[,] a = new int[6, 7];
- Kelet(a);
- PrintMatrix(a);
- for (int i = 0; i < a.GetLength(0); i++)
- {
- for (int j = 0; j < a.GetLength(1); j++)
- {
- if (j == 0)
- a[i, j] += 1000;
- else
- a[i, j] += 100;
- }
- }
- PrintMatrix(a);
- }
- }
- }
- //#2
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication1
- {
- class Program
- {
- public static void PrintMatrix(int[,] a)
- {
- for (int i = 0; i < a.GetLength(0); i++)
- {
- for (int j = 0; j < a.GetLength(1); j++)
- Console.Write("{0,-7}", a[i, j]);
- Console.WriteLine();
- }
- }
- public static void Kelet(int[,] a)
- {
- for (int i = 0; i < a.GetLength(0); i++)
- for (int j = 0; j < a.GetLength(1); j++)
- a[i, j] = int.Parse(Console.ReadLine());
- }
- public static int SumMatrix(int[,] a)
- {
- int sum = 0;
- for (int i = 0; i < a.GetLength(0); i++)
- for (int j = 0; j < a.GetLength(1); j++)
- sum += a[i, j];
- return sum;
- }
- static void Main(string[] args)
- {
- int[,] a = new int[5, 5];
- Kelet(a);
- Console.WriteLine(SumMatrix(a));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement