Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace App
- {
- class Application
- {
- static void Main()
- {
- string image = "@\n@@\n@@@@@\n";
- int sizeY = 0;
- int sizeX = 0;
- int maxX = 0;
- foreach (char item in image)
- {
- if (item == '\n')
- {
- sizeY++;
- if (sizeX > maxX) { maxX = sizeX; }
- sizeX = 0;
- continue;
- }
- sizeX++;
- }
- Console.Write(image);
- Console.WriteLine();
- Console.WriteLine("Y: " + sizeY);
- Console.WriteLine("X: " + maxX);
- Console.ReadKey();
- }
- }
- }
Add Comment
Please, Sign In to add comment