Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace TribonacciSequence
- {
- class Program
- {
- static void Main(string[] args)
- {
- int number = int.Parse(Console.ReadLine());
- TribonacciSequence(number);
- }
- static void TribonacciSequence(int num)
- {
- int[] current = new int[num + 3];
- current[0] = 1;
- for (int i = 3; i < num + 3; i++)
- {
- current[i] = current[i - 1] + current[i - 2] + current[i - 3];
- Console.Write($"{current[i]} ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement