Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Cw1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[,] tab2D = new int[10, 10];
- Make_Identity(tab2D);
- }
- static void Make_Identity(int[,] tab2D)
- {
- int j = 0;
- //Wypełnia 0
- for (int i = 0; i < 10; i++)
- {
- for (int c = 0; c < 10; c++)
- {
- tab2D[i, c] = 0;
- }
- }
- //Wypełnia 1 na głównej przekątnej
- for (int i = 0; i < 10; i++)
- {
- tab2D[i, j] = 1;
- j++;
- }
- j = 0;
- foreach (int i in tab2D)
- {
- Console.Write(i + " ");
- j++;
- if (j == 10)
- Console.WriteLine("");
- else if (j == 20)
- Console.WriteLine("");
- else if (j == 30)
- Console.WriteLine("");
- else if (j == 40)
- Console.WriteLine("");
- else if (j == 50)
- Console.WriteLine("");
- else if (j == 60)
- Console.WriteLine("");
- else if (j == 70)
- Console.WriteLine("");
- else if (j == 80)
- Console.WriteLine("");
- else if (j == 90)
- Console.WriteLine("");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement