Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace arrayszorzas
- {
- class Program
- {
- static void Main(string[] args)
- {
- while (true)
- {
- Console.Write("Sorok szama: ");
- int m = int.Parse(Console.ReadLine());
- Console.Write("Oszlopok szama: ");
- int n = int.Parse(Console.ReadLine());
- if (m == 0 || n == 0) break;
- int[,] mat = new int[m, n];
- Console.WriteLine("Matrix beolvasasa ");
- for (int i = 0; i < m; i++)
- {
- for (int j = 0; j < n; j++)
- {
- mat[i, j] = int.Parse(Console.ReadLine());
- }
- }
- Console.Write("Melyik szammal szorzod a matrix elemeit: ");
- int k = int.Parse(Console.ReadLine());
- for (int i = 0; i < m; i++)
- {
- for(int j = 0; j < n; j++)
- {
- mat[i, j] *= k;
- }
- }
- Console.WriteLine("A matrix kiirasa");
- for (int i = 0; i < m; i++)
- {
- for (int j = 0; j < n; j++)
- {
- Console.Write("{0}\t", mat[i, j]);
- }
- Console.Write("\n");
- }
- Console.WriteLine("Kolity Kristof");
- Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement