Menampilkan Perulangan Karakter Membentuk Segitiga C# Posted by Unknown on January 13, 2015 Get link Facebook X Pinterest Email Other Apps Dengan input berupa : Karakter dan Jumlah Tingkatan yang akan ditampilkan. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MODUL3_8 { class Program { static void Main(string[] args) { char a; int n; Console.Write("Input 1 karakter = "); a = Convert.ToChar(Console.ReadLine()); Console.Write("Jumlah Tingkatan (min.1) ="); n = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(); for (int i = n; i > 0; i--) { for (int j = i; j > 0; j--) Console.Write(a); Console.WriteLine(); } for (int i = 1; i <= n; i++) { for (int j = i; j > 0; j--) Console.Write(a); Console.WriteLine(); } Console.ReadKey(); } } } Comments
Comments
Post a Comment