三角形

Console.Write("请输入直角三角形的行数:");inta = Convert.ToInt32(Console .ReadLine ());for(intb =0; b < a +1; b++) {for(intc =1; c < b *2; c++) { Console.Write("*"); } Console.WriteLine(""); } Console.ReadKey();

Console.Write("请输入直角三角形的行数:");inta = Convert.ToInt32(Console.ReadLine());for(intb =0; b < a +1; b++) {for(intc =0; c < a-b; c++) { Console.Write("*"); } Console.WriteLine(""); } Console.ReadKey();

Console.Write("请输入等腰三角形的行数:");inta = Convert.ToInt32(Console .ReadLine ());for(intb =0; b < a; b++) {for(intc =0; c < a - b -1; c++) { Console.Write(" "); }for(intd =0; d <2* b +1; d++) { Console.Write ("*"); } Console.WriteLine("\n"); } Console .ReadKey ();

你可能感兴趣的:(三角形)