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;
- namespace ConsoleApplication5
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Fibonacci - sorozat");
- int a = 1, b = 1;
- Console.WriteLine("Induló értékek: " + a + " " + b);
- for (int i=1; a+b<=40000; i++){
- if (i % 2 == 0)
- {
- a += b;
- Console.Write("{0,6}", a);
- }
- else
- {
- b += a;
- Console.Write("{0,6}", b);
- }
- if (i % 5 == 0)
- {
- Console.Write("\n");
- }
- }
- Console.WriteLine();
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement