Guest User

Untitled

a guest
Jun 24th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. using System;
  2.  
  3. namespace App
  4. {
  5. class Application
  6. {
  7. static void Main()
  8. {
  9. string image = "@\n@@\n@@@@@\n";
  10. int sizeY = 0;
  11. int sizeX = 0;
  12. int maxX = 0;
  13.  
  14. foreach (char item in image)
  15. {
  16. if (item == '\n')
  17. {
  18. sizeY++;
  19. if (sizeX > maxX) { maxX = sizeX; }
  20. sizeX = 0;
  21. continue;
  22. }
  23. sizeX++;
  24. }
  25.  
  26. Console.Write(image);
  27. Console.WriteLine();
  28. Console.WriteLine("Y: " + sizeY);
  29. Console.WriteLine("X: " + maxX);
  30.  
  31. Console.ReadKey();
  32. }
  33. }
  34. }
Add Comment
Please, Sign In to add comment