c语言99乘法表正倒三角
时间: 2023-08-14 17:06:54 浏览: 228
PIDC,c语言99乘法表源码解释,c语言
以下是C语言中打印九九乘法表正倒三角的代码示例:
正三角靠右:
```c
#include <stdio.h>
int main() {
int a, n, b;
printf("正三角靠右:\n\n");
for (a = 1; a < 10; a++) {
for (n = 9; n > a; n--) {
printf(" ");
}
for (b = 1; b <= a; b++) {
printf("%d*%d=%2d\t", a, b, a * b);
}
printf("\n");
}
return 0;
}
```
倒三角靠右:
```c
#include <stdio.h>
int main() {
int a, n, b;
printf("倒三角靠右:\n\n");
for (a = 1; a < 10; a++) {
for (n = 1; n < a; n++) {
printf(" ");
}
for (b = 9; b >= a; b--) {
printf("%d*%d=%2d\t", a, b, a * b);
}
printf("\n");
}
return 0;
}
```
以上代码可以在C语言中打印出九九乘法表的正倒三角形式。
#### 引用[.reference_title]
- *1* [c语言:九九乘法表 | 正三角形 | 倒三角形](https://blog.csdn.net/xinanbo/article/details/113175807)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* *3* [C语言中的输出99乘法表4种方法](https://blog.csdn.net/qq_43178535/article/details/126963299)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文