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.Threading.Tasks;
- namespace ConsoleApp4
- {
- class Program
- {
- public static void Fibonacci(int x, int y, int n)
- {
- int b = x + 1;
- Console.WriteLine(n + " kolejnych liczb ciągu Fibonacciego od liczby x = " + x);
- for (int i = 0; i < n; i++)
- {
- int temp = x;
- x = b;
- b = temp + b;
- Console.WriteLine(x);
- }
- int a = y + 1;
- Console.WriteLine(n + " kolejnych liczb ciągu Fibonacciego od liczby y = " + y);
- for (int i = 0; i < n; i++)
- {
- int temp = y;
- y = a;
- a = temp + a;
- Console.WriteLine(y);
- }
- }
- public static void Main (String[] args)
- {
- int n;
- Console.WriteLine("Podaj liczbę n: ");
- n = int.Parse(Console.ReadLine());
- int x;
- Console.WriteLine("Podaj liczbę x: ");
- x = int.Parse(Console.ReadLine());
- int y;
- Console.WriteLine("Podaj liczbę y: ");
- y = int.Parse(Console.ReadLine());
- Fibonacci(x, y, n);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment