c语言循环嵌套问题
来源:百度知道 编辑:UC知道 时间:2024/09/26 01:16:20
怎么用循环嵌套输出
*
* *
* * *
* * * *
* * * * *
* * * * * *
.
.
.
.
.
和
1
12
123
1234
12345
123456
。
。
。
。
以及乘法运算小九九。
刚才输入错了 *号应该是像金字塔那样排列下来。。
2楼你好像没看清我的问题。。。*号的和数字的不是一道题。。
*
* *
* * *
* * * *
* * * * *
* * * * * *
.
.
.
.
.
和
1
12
123
1234
12345
123456
。
。
。
。
以及乘法运算小九九。
刚才输入错了 *号应该是像金字塔那样排列下来。。
2楼你好像没看清我的问题。。。*号的和数字的不是一道题。。
根据你的补充要求又改了,已经编译运行确认:
输出*:
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
for(i=1;i<=6;i++)
{
for(j=1;j<=6-i;j++)
{
printf(" ");
}
for(j=1;j<=i;j++)
{
printf("* ");
}
printf("\n");
}
getch();
}
输出数字:
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
for(i=1;i<=6;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",j);
}
printf("\n");
}
getch();
}
99乘法表:
#include <stdio.h>
#include <conio.h>
int main(){
int t[10][10]={0};
int i,j;
for(i=1;i<10;i++)
for(j=1;j<10;j++)
t[i][j]=i*j;
for(i=1;i<10;i++){
for(j=1;j<10;j++)
if(i