C# Pattern Urutan Geometris

Geometri adalah salah satu cabang matematika yang mempelajari tentang ukuran, bentuk, sudut posisi, dan dimensi benda.

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

namespace GeometricSequence
{
    class Program GeometricSequence
    {
        static void Main(string[] args)
        {
            int n = 5;
            int r = 2;
            int a = 5;
            int sum = 0;
            for (int i = 1; i <= n; i++)
            {
                Console.Write(" " + a);
                a = a * r;
            }
            Console.ReadKey(true);
        }
    }
}

Output:

5 10 20 40 80

Leave a Reply

Your email address will not be published. Required fields are marked *