Cara membuat program sederhana print asterisk(bintang) c# Asp.Net Part1

Untuk menjadi Developer Web harus tahu tentang Looping dalam program, untuk mempercepat pembuatan program dan melatih logika pemrograman. Penulis menyarankan kode di bawah ini untuk dipahami.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace part1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Input the number of starts = ");
            int n = int.Parse(Console.ReadLine());
            Console.WriteLine("The result will be as below :");
            for (int i = 1; i <= n; i++)
            {
                for (int j = 1; j <= i; j++)
                {
                    Console.Write("*");
                }
                Console.WriteLine();
            }
            Console.ReadLine();
        }
    }
}

  • Output 


Previous
Next Post »