Print Number Square Pattern in C Programming

By | June 20, 2019

“Print Number Square Pattern in C Programming” is a C program to display number pattern in the shape of a square as shown in the following figure:

Print number square shape pattern in C programming

Print number square shape pattern in C programming

The source code for printing a number square pattern in C programming is as follows:

/*
Write a program to print number pattern
square shape in c programming 
language as shown below

   11111
   22222
   33333
   44444
   55555

*/
#include<stdio.h>  
int main()   
{   
  int row, col;  
  for( row = 1; row <=5;row++)
  {
  	for(col=1; col<=5; col++)
	   printf("%d",row);   
  	printf("\n");
  }
  return 0;
}  

Here is an image to show the sample run and output of this C program to display a square shape made by numbers.

print-number-square-pattern-shape-in-c-programming-code

print-number-square-pattern-shape-in-c-programming-code

Loading

Leave a Reply

Your email address will not be published. Required fields are marked *