帮忙编程序,用C语言,输出如下图形!

来源:百度知道 编辑:UC知道 时间:2024/05/06 18:08:19
*
***
*****
*******
*****
***
*

我做过答的
#include<stdio.h>
main()
{
int i,j;
for(i=1;i<=7;i+=2)
{
for(j=1;j<=i;j++)
printf("*");
printf("\n");
}
for(i=5;i>=1;i-=2)
{
for(j=1;j<=i;j++)
printf("*");
printf("\n");
}
}

#include<stdio.h>
#include<conio.h>
main()
{
printf("*\n");
printf("***\n");
printf("*****\n");
printf("*******\n");
printf("*****\n");
printf("***\n");
printf("*\n");
getch();
}

c++代码:
#include<iostream.h>
void main()
{
for(int a=1;a<=7;a+=2)
{
for(int b=1;b<=a;b++)
cout<<'*';
cout<<endl;
}
int c(a-4),d;
for(;c>=1;c-=2)
{
for(d=1;d<