Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main()
- {
- long n1 = long.Parse(Console.ReadLine());
- long n2 = long.Parse(Console.ReadLine());
- long n3 = long.Parse(Console.ReadLine());
- long n4 = long.Parse(Console.ReadLine());
- int row = int.Parse(Console.ReadLine());
- int col = int.Parse(Console.ReadLine());
- int total = row * col;
- long[] arr = new long[total];
- long sum = 0L;
- arr[0] = n1;
- arr[1] = n2;
- arr[2] = n3;
- arr[3] = n4;
- for (int i = 4; i < total; i++)
- {
- sum = n1 + n2 + n3 + n4;
- arr[i] = sum;
- n1 = n2;
- n2 = n3;
- n3 = n4;
- n4 = sum;
- }
- for (int i = 0; i < total; i++)
- {
- if (i != 0)
- {
- if ((i % (total / row)) == 0)
- {
- Console.WriteLine();
- }
- }
- Console.Write(arr[i] + " ");
- }
- Console.WriteLine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement