CODING JOY

The stunning potpourri of coding and mundane life

PLUS SIGN IN C LANGUAGE



AMRUHA AHMED
15th December,2023.



This article will aid you in the creation of a plus sign in C language using a combination of nested loops. blog1

DELVING DEEPER:

BREAK-UP OF THE PATTERN:

blog1

PROGRAM:

                
                    #include<stdio.h>
                    void main()
                    {
                        int m=5;//spaces before the *
                        int i,j;//loop counters
                        for(i=1;i<=11;i++)
                        {
                            if(i!=6)//when the iteration hasn't reached the middle of the pattern
                            {
                                for(j=1;j<=m;j++)
                                printf("  ");
                                printf("* ");
                            }
                            else//outer loop has reached the middle of the pattern
                            {
                                for(j=1;j<=11;j++)//printing the horizontal line
                                printf("* ");
                            }
                            printf("\n");
                        }
                    }                    
             
         
CODE COPIED

OUTPUT:

blog1