参考下面的算法,编写C程序以显示X形状的数字。
算法
Step 1: Start
Step 2: Declare variables
Step 3: Read number of rows
Step 4: for loop satisfies
- if(i==j || i+j==rows-1)
- print i+1
- Print " "
Step 5: Print new line
Step 6: Stop登录后复制
The logic to print numbers in X pattern is as follows −
for(i=0;i