Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- int x, y;
- // Input 'X' & 'Y':
- Console.WriteLine("Enter a value for 'X' (Range of 1-99999):");
- x = int.Parse(Console.ReadLine());
- Console.WriteLine("Enter a value for 'Y' (Range of 1-99999):");
- y = int.Parse(Console.ReadLine());
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // Getting the length of the fiboArray:
- int first = 1, second = 1, temp, counter = 0, i = 0;
- while (second < 99999)
- {
- temp = second;
- second += first;
- first = temp;
- counter++;
- }
- // Inputing the fiboArray values:
- int[] fiboArray = new int[counter];
- first = 1;
- second = 1;
- while (second < 99999)
- {
- fiboArray[i] = second;
- temp = second;
- second += first;
- first = temp;
- i++;
- }
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // Assign Values to the grid:
- int[,] grid = new int[x + 8, y + 9];
- counter = 0;
- int f=0;
- for (i = 0; i < x + 8; i++)
- {
- for (int j = 0; j < y + 9; j++)
- {
- if (i > j)
- {
- while (j > fiboArray[f])
- {
- f++;
- }
- while (i > fiboArray[f])
- {
- counter++;
- f++;
- }
- }
- else
- {
- while (i > fiboArray[f])
- {
- f++;
- }
- while (j > fiboArray[f])
- {
- counter++;
- f++;
- }
- }
- grid[i, j] = counter;
- counter = 0;
- f = 0;
- }
- }
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // Print the grid:
- for (i = 0; i < x + 8; i++)
- {
- for (int j = 0; j < y + 9; j++)
- {
- Console.Write(grid[i, j]);
- }
- Console.WriteLine("");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement