c - 编写一个基本的半金字塔图案程序
问题描述
尝试了一些基本模式
试图获得模式
1
2 4
3 6 12
4 8 16 32
到目前为止,试图找到正确的序列,我的想法是需要另一个变量让我们说 num,并且需要为 num 创建一个序列以最终打印 num
#include <stdio.h>
int main()
{
int rows = 0 , i, j , num,num2;
do{
printf("please enter the number of rows: ");
scanf("%d",&rows);
}while(rows <=2 );
printf("printing a half pyramid of %d rows", rows);
printf("\n");
for( i = 1; i <=rows; ++i) {
for (j = 1; j <= i; ++j ) {
printf("%d ", );
}
printf("\n");
}
return 0;
}
无法弄清楚顺序
解决方案
推荐阅读
- ionic-framework - 响应状态:0 对于 URL:null – 当我在模拟器或 Web 中运行时出现此错误
- c# - 使用AutoMapper映射DTO后,Id字段变为0
- java - 用字母交替生成句子以防万一
- html - Angular:使用 ComponentFactoryResolver 进行组件的动态实例化,在 SVG 中渲染
- python - Python 请求 set-cookie 未正确设置
- python - 如何使用 python 装饰器修复“NoneType”错误?
- javascript - jQuery:单击时更改 div 文本,不会多次使用
- reactjs - 在 React 上的酶中使用 setState() useState()
- javascript - WebExtensions 的问题:第二个注入的脚本看不到第一个
- hazelcast-jet - Hazelcast Jet - 按用例分组