網(wǎng)站首頁 編程語言 正文
主要是用for循環(huán)來寫九九乘法表
1.左下角
#include <stdio.h>
int main()
{
int i, j;
for (i = 1; i < 10; i++)
{
for (j = 1; j <= i; j++)
{
printf("%d*%d=%-3d ", j, i, i * j);
}
printf("\n");
}
return 0;
}
2.等腰三角形
#include <stdio.h>
int main()
{
int a = 0, b = 0, c = 0;
for (a = 9; a >= 1; a--)
{
for (c = 0; c <= (8 - a) * 4; c++)
{
printf(" ");
}
for (b = 1; b <= a; b++)
printf("%d*%d=%2d ", a, b, a * b);
printf("\n\n");
}
return 0;
}
3.左上角
#include <stdio.h>
int main()
{
int i = 0, j = 0;
for (i = 9; i >= 1; i--)
{
for (j = 1; j <= i; j++)
printf("%d*%d=%-3d ", i, j, i * j);
printf("\n");
}
return 0;
}
4.右上角
#include <stdio.h>
int main()
{
int i, j;
for (i = 9; i > 0; i--)
{
for (j = 9; j > 0; j--)
{
if (i < j)
printf("\t");
else
printf("%d*%d=%2d ", j, i, i * j);
}
printf("\n");
}
return 0;
}
5.右下角
#include <stdio.h>
int main()
{
int i = 0, j = 0;
for (i = 1; i < 10; i++)
{
for (j = 9; j > 0; j--)
{
if (i >= j)
printf("%d*%d=%-3d ", i, j, i * j);
else
printf("\t");
}
printf("\n");
}
return 0;
}
原文鏈接:https://blog.csdn.net/qq_44394562/article/details/125919155
相關(guān)推薦
- 2022-12-23 C++?Boost?Exception超詳細(xì)講解_C 語言
- 2022-11-01 Android?Activity?Results?API代替onActivityResult處理頁面
- 2022-11-17 Android開發(fā)Flutter?桌面應(yīng)用窗口化實戰(zhàn)示例_Android
- 2022-10-06 Android?Fragment源碼分析Add方法_Android
- 2022-11-23 TypeScript前端上傳文件到MinIO示例詳解_其它
- 2022-10-12 antd為Tree組件標(biāo)題附加操作按鈕功能_Redis
- 2022-12-23 C語言例題之輸出1000以內(nèi)的所有完數(shù)_C 語言
- 2022-05-20 詳解在SQLPlus中實現(xiàn)上下鍵翻查歷史命令的功能_MsSql
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡單動態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支