using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Q2_VisualisingGraphs_V1 { internal class Program { static void Main(string[] args) { //Declare variables int y = 9; int scale = 4; int[] yData = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; int x = yData.Length; for (int i = 0; i < y; i++) { //Get current y value int currentY = scale; if (currentY == 0) { //Write the x axis at y = 0 Console.Write(" " + currentY + "+"); for (int q = 0; q < x; q++) { Console.Write("-"); } Console.WriteLine(); } else { Console.Write(currentY.ToString().PadLeft(2) + "|"); for (int j = 0; j < x; j++) { //Check if the data matches the current y if (yData[j] == currentY) { //If so write an x Console.Write("x"); } else { //Else blank Console.Write(" "); } } Console.WriteLine(); } //Decrease scale by 1 scale -= 1; } Console.ReadLine(); } } }