Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Numerics;
- namespace ConsoleApplication2
- {
- class Program
- {
- static void Main(string[] args)
- {
- BigInteger result = new BigInteger();
- int memberOne = int.Parse(Console.ReadLine());
- int memberTwo = int.Parse(Console.ReadLine());
- int memberThree = int.Parse(Console.ReadLine());
- int memberAdd = int.Parse(Console.ReadLine());
- BigInteger first = memberOne;
- BigInteger second = memberTwo;
- BigInteger third = memberThree;
- for (int i = 4; i <= memberAdd; i++)
- {
- result = first + second + third;
- first = second;
- second = third;
- third = result;
- }
- Console.WriteLine(result);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement