Script :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace loop_while_bintang2
{
class Program
{
static void Main(string[] args)
{
int x, y, bil;
Console.Write("Masukkan Bilangan : ");
bil = int.Parse(Console.ReadLine());
x = 1;
while (x <= bil)
{
y = 1;
while (y <= x)
{
if (y % 2 ==
0)
{
Console.ForegroundColor
= ConsoleColor.Red;
Console.Write("*");
}
else
{
Console.ForegroundColor
= ConsoleColor.Black;
Console.Write("*");
}
if (y == x)
Console.Write("\n");
y++;
}
x++;
}
Console.Read();
}
}
}
EmoticonEmoticon