C Programming
Computer Programming

Program in C to display the number pattern



Write a Program in c to display the following Pattern :


5 5 5 5 5
4 5 5 5 5
3 4 5 5 5
2 3 4 5 5
1 2 3 4 5

\* C Program to display the number pattern *\

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

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

k = n + 1 - i  ;
for (  j = 1 ; j <= n ; j++ )
{

if (   i >= j  )
{

printf("   %d " ,  k) ;
k = k + 1 ;

}
else
printf("   %d " ,  n) ;

}
printf(" \n ") ;

}
return ( 0 );

}

Output of Program :

Output of Program in C to diagonal number pattern