Print Number Star Square Pattern Type6

4 comments on “Print Number Star Square Pattern Type6”


  • manikanta kumar

    #include
    int main()
    {
    int i,j,l,count=5; //declaring integers i,j for loops and l for number of rows
    printf(“Enter the number of rows/columns\n”); //Asking user for input
    scanf(“%d”,&l); //Taking the input for number of rows
    for(int i=0;i<l;i++) //Outer loop for number of rows
    {
    if(i==1)
    {
    count+=l+l+l;
    }
    if(i==l-1)
    {
    count=4*l+1;
    }
    for(int j=0;j<l;j++) //Inner loop for number of columns in each row
    {
    count–;
    if(j==l-1)
    {
    printf("%d",count);
    }
    else
    {
    printf("%d*",count);
    }
    }
    printf("\n"); //Printing a new line after each row has been printed.
    }
    }