Program to print number 7 in C Language without Graphics

// Program to print number 7 in C language with CBhashaGyan

#include<stdio.h>

int main()

{

int i, j;

for (i=1; i<=5; i++)

{

    printf("\t");                //allow horizontal tab

    for(j=1; j<=5; j++)
   
     {

       if(i==1 && j<=3)

       printf("* ");      //star and space

       else if((i==3 && (j==2 || j==4)) || ( j==5-i+1 && i>=2))

       printf("*");      //allow star

       else
    
       printf("  ");        //double space

    }

   printf("\n");          //new line

}

return 0;

}

Output:


*  *  *
     *
  ***
  *         
*  
         

Practical demonstration in Pictorial form-


Program to print number 7 in C Language without Graphics
Program to print number 7 in C Language without Graphics

Output:-

Program to print number 7 in C Language without Graphics Output
Program to print number 7 in C Language without Graphics Output

No comments:

Post a Comment