C Programming
Computer Programming

Program in C to display the number pattern in diamund shape



Write a Program in c to display the following Pattern :

               1
           1 2 3
       1 2 3 4 5
    1 2 3 4 5 6 7
1 2 3 4 5 6 7 8 9
    1 2 3 4 5 6 7
       1 2 3 4 5
           1 2 3
              1

\* C Program to display the number pattern in diamund shape *\

# include < stdio.h >
int   main( )
{

int   i, j, r, k ;
printf(" Enter the Number of row : ") ;
scanf("%d ", & r) ;
printf("\n Pattern are : \n\n") ;
for (  i = 1 ; i < = r ; i++ )
{

for (  j = i ; j < = r ; j++ )
printf("    ") ;

for (  j = 1 ; j < = 2 * i - 1 ; j++ )
{

printf("   %d " ,  j) ;

}
printf(" \n ") ;

}
for (  i = r - 1 ; i > = 1 ; i-- )
{

for (  j = r ; j >= i ; j-- )
printf("    ") ;

for (  j = 1 ; j <= 2 * i - 1; j++ )
{

printf("   %d " ,  j) ;

}
printf(" \n ") ;

}
return ( 0 );

}

Output of Program :

Output of Program in C to display the number pattern in diamund shape