Senin, 22 Desember 2014

PROGRAM SUSUNAN BINTANG WARNA TERTENTU



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

namespace ConsoleApplication18
{
    class Program
    {
        static void Main(string[] args)
        {
            int baris, kolom;

            for (baris = 0; baris <= 9; baris++)
            {
                for (kolom = 0; kolom <= baris; kolom++)
                {
                    if (kolom % 2 == 1)
                    {
                        Console.ForegroundColor = ConsoleColor.Magenta;
                        Console.Write("*");
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.White;
                        Console.Write("*");
                    }
                }
                Console.Write("\n");
                Console.ReadLine();
            }
        }
    }
}



Hasil Outputnya




Tidak ada komentar:

Posting Komentar