Advertisement
svetoslavhl

Tribonacci_Triangle

Mar 4th, 2014
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5. static void Main(string[] args)
  6. {
  7. long num1 = long.Parse(Console.ReadLine());
  8. long num2 = long.Parse(Console.ReadLine());
  9. long num3 = long.Parse(Console.ReadLine());
  10.  
  11. int L = int.Parse(Console.ReadLine());
  12.  
  13. Console.WriteLine(num1);
  14. Console.Write("{0} ",num2);
  15. Console.Write(num3);
  16. Console.WriteLine();
  17. long aux = 0;
  18. int count = 3;
  19. while (count <= L) {
  20.  
  21. for (int i = 0; i < count; i++)
  22. {
  23. num1 = num1 + num2 + num3;
  24. aux = num1;
  25. num1 = num2;
  26. num2 = num3;
  27. num3 = aux;
  28. Console.Write("{0} ", num3);
  29.  
  30. }
  31. Console.WriteLine();
  32. count++;
  33.  
  34.  
  35.  
  36.  
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement