Facebook
From Dawid, 3 Years ago, written in C#.
Embed
Download Paste or View Raw
Hits: 67
  1. static void Main(string[] args)
  2.         {
  3.            
  4.            
  5.             System.Console.WriteLine("Podaj liczbę rzędów bombonierki");
  6.             int rz = int.Parse(Console.ReadLine());
  7.  
  8.             System.Console.WriteLine("Podaj liczbę kolumn bombonierki");
  9.             int klmn = int.Parse(Console.ReadLine());
  10.  
  11.             int[,] bomb = new int[rz, klmn];
  12.  
  13.            
  14.  
  15.        
  16.          
  17.            
  18.            
  19.        
  20.                 System.Console.WriteLine("podaj rząd czekoladki,którą chcesz zjeść");
  21.                 int wart1 = int.Parse(Console.ReadLine());
  22.  
  23.  
  24.                 System.Console.WriteLine("podaj kolumnę czekoladki,którą chcesz zjeść ");
  25.                 int wart2 = int.Parse(Console.ReadLine());
  26.  
  27.                 int rzad = wart1 - 1;
  28.                
  29.                 int kolumna = wart2 - 1;
  30.  
  31.            
  32.  
  33.                  bomb[rzad, kolumna] = 1;
  34.  
  35.                
  36.  
  37.  
  38.  
  39.  
  40.  
  41.                 for (int x = 0; x < bomb.GetLength(0); x++)
  42.  
  43.                 {
  44.  
  45.                     for (int y = 0; y < bomb.GetLength(1); y++)
  46.  
  47.                     {
  48.                    
  49.                    
  50.                     Console.WriteLine("[" + (x + 1) + "," + (y + 1) + "] = " + bomb[x, y]);
  51.                    
  52.  
  53.                     }
  54.  
  55.                 }
  56.  
  57.  
  58.               Console.WriteLine("Zjadłeś czekoladkę z rzędu: " + wart1 + " i kolumny: " + wart2);
  59.            
  60.        }