当前位置:网站首页>C outputs a two-dimensional array with the following characteristics.
C outputs a two-dimensional array with the following characteristics.
2022-04-23 08:09:00 【laocooon】
1 2 2 2 2 2 1
3 1 2 2 2 1 4
3 3 1 2 1 4 4
3 3 3 1 4 4 4
3 3 1 5 1 4 4
3 1 5 5 5 1 4
1 5 5 5 5 5 1
#include <stdio.h>
void main()
{
int a[7][7];
int i,j;
for (i=0;i<7;i++)
for (j=0;j<7;j++)
{
if (i==j||i+j==6) //i==j||i+j==6
a[i][j]=1;
else if (i<j&&i+j<6)
a[i][j]=2;//a[i][j]=2
else if (i>j&&i+j<6)
a[i][j]=3;
else if (i<j && i + j> 6 ) //i<j && i + j> 6
a[i][j]=4;
else
a[i][j]=5;
}
for (i=0;i<7;i++)
{
for (j=0;j<7;j++)
printf("%4d",a[i][j]);
printf("\n");//printf("\n");
}
}
版权声明
本文为[laocooon]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230638292776.html
边栏推荐
猜你喜欢
随机推荐
从ES、MongoDB、Redis、RocketMQ出发谈分布式存储
Dvwa 靶场练习记录
浏览器中的 Kubernetes 和 IDE | 交互式学习平台Killercoda
分布式服务治理Nacos
sentinel集成nacos动态更新数据原理
Implementation of new
Cloud computing skills competition -- the first part of openstack private cloud environment
AAAI 2022招募讲者啦!!
DVWA靶场练习
[go]常见的并发模型[泛型版]
Mysql database backup and recovery under Linux (full + incremental)
KVM安装部署
雲計算技能大賽 -- openstack私有雲環境 第一部分
简述CPU
Fibula dynamic programming
Convert object to URL
渗透测试面试合集---HVV---
数据库之Mysql——概述安装篇
CTF攻防世界刷题51-
CTF-MISC学习之从开始到放弃









