Koding Deret Fibonacci C#



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication46
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = 1, y = 1, z = 1;

            Console.Write("jumlah bilangan Fibonacci yang ingin ditampilkan =");
            int jumlah = Convert.ToInt32(Console.ReadLine());
            for (int i = 0; i < jumlah; i++)
            {
                Console.Write(z + " ");
                z = x + y;
                x = y;
                y = z;

                Console.ReadLine();
            }
        }
    }
}

Comments

Popular posts from this blog

DDL (DATA DEFINITION LANGUAGE)

KODING DERET FIBONACCI C#

Cara Mengatasi Tombol FN Error