Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Bounce
- {
- class Program
- {
- static void Main(string[] args)
- {
- string values = Console.ReadLine();
- string[] tokens = values.Split(' ');
- int[] convertedItems = Array.ConvertAll<string, int>(tokens, int.Parse);
- int n = convertedItems[0];
- int m = convertedItems[1];
- //declare matrix
- int[,] matrix = new int[n, m];
- var sum = 0;
- //fill matrix with correct vallues
- for (int row = 0; row < n; row++)
- {
- for (int col = 0; col < m; col++)
- {
- matrix[row, col] = (int)Math.Pow(2, row + col);
- }
- }
- Print(matrix);
- Console.WriteLine(sum);
- }
- static void Print(int[,] matrixToPrint)
- {
- for (int row = 0; row < matrixToPrint.GetLength(0); row++)
- {
- for (int col = 0; col < matrixToPrint.GetLength(1); col++)
- {
- Console.Write(matrixToPrint[row, col] + " ");
- }
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement