本文主要是介绍c语言九九乘法表左下三角形,九九乘法表的四种三角形排布方式(for循环以及while循环的互换)...,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
#region
//右上
for (int i = 1; i <= 9; i++){
for (int j = 1; j <= 9; j++){
if (i > j){
Console.Write("");
} else{
Console.Write("{0}*{1}={2}", i, j, i * j);
}
}
Console.Write("
");
}
Console.ReadKey();
//右下
for (int i = 1; i <= 9; i++){
for (int j = 1; j <= 9; j++){
if (i < 9 + 1 - j){
Console.Write("");
}else{
Console.Write("{0}*{1}={2}", i, j, i * j);
}
}
Console.Write("
");
}
Console.ReadKey();
Console.Write("
上层结束
");
//左上
for (int i = 1; i <= 9; i++){
for (int j = i; j <= 9; j++)
{
if (i > j){
Console.Write("");
} else{
Console.Write("{0}*{1}={2}", i, j, i * j);
}
}
Console.Write("
");
}
Console.ReadKey();
Console.Write("
");
//左下
for (int i = 1; i <= 9; i++){
for (int j = 1; j <= 9; j++){
if (i
Console.Write("");
}else{
Console.Write("{0}*{1}={2}", i, j, i * j);
}
}
Console.Write("
");
}
Console.ReadKey();
Console.Write("
");
//右上
for (int i = 1; i <= 9; i++){
for (int a = 1;a < i; a++){
Console.Write("");
}
for (int j = i; j <= 9; j++) {
Console.Write("{0}*{1}={2}", i, j, i * j);
}
Console.Write("
");
}
Console.ReadKey();
Console.Write("
");
#endregion
附加运行结果:
这篇关于c语言九九乘法表左下三角形,九九乘法表的四种三角形排布方式(for循环以及while循环的互换)...的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!