My C language learning journey

sky-999(43)
Published in
#art
Words
51
Reading
1 min
Listen
Play
7y

未标题-1.jpg
I want to write a code to print rhombus with use C program language.This code would used six for statements.The previous three for statements be used to print the upper five lines.After three for statements be used to print the following four lines.code as follows:

#include"stdio.h"
int main(void){

int a,b;
for(a=1;a<=5;a++)
{
    for(b=1;b<=5-a;b++)
        printf(" ");
    for(b=1;b<=2*a-1;b++)
        printf("*");
        printf("\n");
}
for(a=1;a<=4;a++)
{
    for(b=1;b<=a;b++)
        printf(" ");
    for(b=2*a-1;b<=7;b++)
        printf("*");
        printf("\n");
}
    return 0;

}

捕获.PNG

My C language learning journey | Ecency